Panda3D
graphicsWindow.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file graphicsWindow.cxx
10  * @author mike
11  * @date 1997-01-09
12  */
13 
14 #include "graphicsWindow.h"
15 #include "graphicsPipe.h"
16 #include "config_display.h"
17 #include "mouseButton.h"
18 #include "keyboardButton.h"
19 #include "lightMutexHolder.h"
20 #include "lightReMutexHolder.h"
21 #include "throw_event.h"
22 #include "string_utils.h"
23 
24 using std::string;
25 
26 TypeHandle GraphicsWindow::_type_handle;
27 
28 /**
29  * Normally, the GraphicsWindow constructor is not called directly; these are
30  * created instead via the GraphicsEngine::make_window() function.
31  */
32 GraphicsWindow::
33 GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
34  const string &name,
35  const FrameBufferProperties &fb_prop,
36  const WindowProperties &win_prop,
37  int flags,
39  GraphicsOutput *host) :
40  GraphicsOutput(engine, pipe, name, fb_prop, win_prop, flags, gsg, host, true),
41  _input_lock("GraphicsWindow::_input_lock"),
42  _properties_lock("GraphicsWindow::_properties_lock")
43 {
44 #ifdef DO_MEMORY_USAGE
45  MemoryUsage::update_type(this, this);
46 #endif
47 
48  if (display_cat.is_debug()) {
49  display_cat.debug()
50  << "Creating new window " << get_name() << "\n";
51  }
52 
53  _properties.set_open(false);
54  _properties.set_undecorated(false);
55  _properties.set_fullscreen(false);
56  _properties.set_minimized(false);
57  _properties.set_cursor_hidden(false);
58 
59  request_properties(WindowProperties::get_default());
60  request_properties(win_prop);
61 
62  _window_event = "window-event";
63  _got_expose_event = false;
64  _unexposed_draw = win_unexposed_draw;
65  set_pixel_zoom(pixel_zoom);
66 }
67 
68 /**
69  *
70  */
71 GraphicsWindow::
72 ~GraphicsWindow() {
73  // Clean up python event handlers.
74 #ifdef HAVE_PYTHON
75  PythonWinProcClasses::iterator iter;
76  for (iter = _python_window_proc_classes.begin();
77  iter != _python_window_proc_classes.end();
78  ++iter) {
79  delete *iter;
80  }
81 #endif
82 }
83 
84 /**
85  * Returns the current properties of the window.
86  */
87 const WindowProperties GraphicsWindow::
88 get_properties() const {
89  WindowProperties result;
90  {
91  LightReMutexHolder holder(_properties_lock);
92  result = _properties;
93  }
94  return result;
95 }
96 
97 /**
98  * Returns the properties of the window that are currently requested. These
99  * properties will be applied to the window (if valid) at the next execution
100  * of process_events().
101  */
102 const WindowProperties GraphicsWindow::
103 get_requested_properties() const {
104  WindowProperties result;
105  {
106  LightReMutexHolder holder(_properties_lock);
107  result = _requested_properties;
108  }
109  return result;
110 }
111 
112 /**
113  * Empties the set of failed properties that will be returned by
114  * get_rejected_properties().
115  */
116 void GraphicsWindow::
118  LightReMutexHolder holder(_properties_lock);
119  _rejected_properties.clear();
120 }
121 
122 /**
123  * Returns the set of properties that have recently been requested, but could
124  * not be applied to the window for some reason. This set of properties will
125  * remain unchanged until they are changed by a new failed request, or
126  * clear_rejected_properties() is called.
127  */
128 WindowProperties GraphicsWindow::
129 get_rejected_properties() const {
130  WindowProperties result;
131  {
132  LightReMutexHolder holder(_properties_lock);
133  result = _rejected_properties;
134  }
135  return result;
136 }
137 
138 /**
139  * Requests a property change on the window. For example, use this method to
140  * request a window change size or minimize or something.
141  *
142  * The change is not made immediately; rather, the request is saved and will
143  * be applied the next time the window task is run (probably at the next
144  * frame).
145  */
146 void GraphicsWindow::
147 request_properties(const WindowProperties &requested_properties) {
148  LightReMutexHolder holder(_properties_lock);
149  _requested_properties.add_properties(requested_properties);
150 
151  if (!_has_size && _requested_properties.has_size()) {
152  // If we just requested a particular size, anticipate that it will stick.
153  // This is helpful for the MultitexReducer, which needs to know the size
154  // of the textures that it will be working with, even if the texture
155  // hasn't been fully generated yet.
156  _size = _requested_properties.get_size();
157 
158  // Don't set _has_size yet, because we don't really know yet.
159  }
160 }
161 
162 /**
163  * Returns true if the window is ready to be rendered into, false otherwise.
164  */
165 bool GraphicsWindow::
166 is_active() const {
167  // Make this smarter?
168  return GraphicsOutput::is_active() && _properties.get_open() && !_properties.get_minimized();
169 }
170 
171 /**
172  * Changes the name of the event that is generated when this window is
173  * modified externally, e.g. to be resized or closed by the user.
174  *
175  * By default, all windows have the same window event unless they are
176  * explicitly changed. When the event is generated, it includes one
177  * parameter: the window itself.
178  */
179 void GraphicsWindow::
180 set_window_event(const string &window_event) {
181  LightReMutexHolder holder(_properties_lock);
182  _window_event = window_event;
183 }
184 
185 /**
186  * Returns the name of the event that is generated when this window is
187  * modified externally, e.g. to be resized or closed by the user. See
188  * set_window_event().
189  */
190 string GraphicsWindow::
191 get_window_event() const {
192  string result;
193  LightReMutexHolder holder(_properties_lock);
194  result = _window_event;
195  return result;
196 }
197 
198 /**
199  * Sets the event that is triggered when the user requests to close the
200  * window, e.g. via alt-F4, or clicking on the close box.
201  *
202  * The default for each window is for this event to be the empty string, which
203  * means the window-close request is handled immediately by Panda (and the
204  * window will be closed without the app getting a chance to intervene). If
205  * you set this to a nonempty string, then the window is not closed, but
206  * instead the event is thrown. It is then up to the app to respond
207  * appropriately, for instance by presenting an "are you sure?" dialog box,
208  * and eventually calling close_window() when the user is sure.
209  *
210  * It is considered poor form to set this string and then not handle the
211  * event. This can frustrate the user by making it difficult for him to
212  * cleanly shut down the application (and may force the user to hard-kill the
213  * app, or reboot the machine).
214  */
215 void GraphicsWindow::
216 set_close_request_event(const string &close_request_event) {
217  LightReMutexHolder holder(_properties_lock);
218  _close_request_event = close_request_event;
219 }
220 
221 /**
222  * Returns the name of the event set via set_close_request_event(). If this
223  * string is nonempty, then when the user requests to close window, this event
224  * will be generated instead. See set_close_request_event().
225  */
226 string GraphicsWindow::
227 get_close_request_event() const {
228  string result;
229  LightReMutexHolder holder(_properties_lock);
230  result = _close_request_event;
231  return result;
232 }
233 
234 /**
235  * Returns the number of separate input devices associated with the window.
236  * Typically, a window will have exactly one input device: the keyboard/mouse
237  * pair. However, some windows may have no input devices, and others may add
238  * additional devices, for instance for a joystick.
239  */
240 int GraphicsWindow::
241 get_num_input_devices() const {
242  int result;
243  {
244  LightMutexHolder holder(_input_lock);
245  result = _input_devices.size();
246  }
247  return result;
248 }
249 
250 /**
251  * Returns the nth input device associated with the window. Typically, a
252  * window will have exactly one input device: the keyboard/mouse pair.
253  */
255 get_input_device(int device) const {
256  LightMutexHolder holder(_input_lock);
257  nassertr(device >= 0 && device < (int)_input_devices.size(), NULL);
258  return _input_devices[device];
259 }
260 
261 /**
262  * Returns the name of the nth input device.
263  */
264 string GraphicsWindow::
265 get_input_device_name(int device) const {
266  string result;
267  {
268  LightMutexHolder holder(_input_lock);
269  nassertr(device >= 0 && device < (int)_input_devices.size(), "");
270  result = _input_devices[device]->get_name();
271  }
272  return result;
273 }
274 
275 /**
276  * Returns true if the nth input device has a screen-space pointer (for
277  * instance, a mouse), false otherwise.
278  */
279 bool GraphicsWindow::
280 has_pointer(int device) const {
281  bool result;
282  {
283  LightMutexHolder holder(_input_lock);
284  nassertr(device >= 0 && device < (int)_input_devices.size(), false);
285  result = _input_devices[device]->has_pointer();
286  }
287  return result;
288 }
289 
290 /**
291  * Returns true if the nth input device has a keyboard, false otherwise.
292  */
293 bool GraphicsWindow::
294 has_keyboard(int device) const {
295  bool result;
296  {
297  LightMutexHolder holder(_input_lock);
298  nassertr(device >= 0 && device < (int)_input_devices.size(), false);
299  result = _input_devices[device]->has_keyboard();
300  }
301  return result;
302 }
303 
304 /**
305  * Returns a ButtonMap containing the association between raw buttons and
306  * virtual buttons.
307  */
310  return nullptr;
311 }
312 
313 /**
314  * Turn on the generation of pointer events.
315  */
316 void GraphicsWindow::
318  LightMutexHolder holder(_input_lock);
319  nassertv(device >= 0 && device < (int)_input_devices.size());
320  _input_devices[device]->enable_pointer_events();
321 }
322 
323 /**
324  * Turn off the generation of pointer events.
325  */
326 void GraphicsWindow::
328  LightMutexHolder holder(_input_lock);
329  nassertv(device >= 0 && device < (int)_input_devices.size());
330  _input_devices[device]->disable_pointer_events();
331 }
332 
333 /**
334  * See GraphicsWindowInputDevice::enable_pointer_mode
335  */
336 /*
337 void GraphicsWindow::
338 enable_pointer_mode(int device, double speed) {
339  LightMutexHolder holder(_input_lock);
340  nassertv(device >= 0 && device < (int)_input_devices.size());
341  _input_devices[device]->enable_pointer_mode(speed);
342 }*/
343 
344 /**
345  * See GraphicsWindowInputDevice::disable_pointer_mode
346  */
347 /*
348 void GraphicsWindow::
349 disable_pointer_mode(int device) {
350  LightMutexHolder holder(_input_lock);
351  nassertv(device >= 0 && device < (int)_input_devices.size());
352  _input_devices[device]->disable_pointer_mode();
353 }*/
354 
355 /**
356  * Returns the MouseData associated with the nth input device's pointer. This
357  * is deprecated; use get_pointer_device().get_pointer() instead, or for raw
358  * mice, use the InputDeviceManager interface.
359  */
361 get_pointer(int device) const {
362  MouseData result;
363  {
364  LightMutexHolder holder(_input_lock);
365  nassertr(device >= 0 && device < (int)_input_devices.size(), MouseData());
366  result = ((const GraphicsWindowInputDevice *)_input_devices[device].p())->get_pointer();
367  }
368  return result;
369 }
370 
371 /**
372  * Forces the pointer to the indicated position within the window, if
373  * possible.
374  *
375  * Returns true if successful, false on failure. This may fail if the mouse
376  * is not currently within the window, or if the API doesn't support this
377  * operation.
378  */
379 bool GraphicsWindow::
380 move_pointer(int, int, int) {
381  return false;
382 }
383 
384 /**
385  * Forces the ime window to close if any
386  *
387  */
388 void GraphicsWindow::
390  return;
391 }
392 
393 /**
394  * Determines which of the indicated window sizes are supported by available
395  * hardware (e.g. in fullscreen mode).
396  *
397  * On entry, dimen is an array containing contiguous x,y pairs specifying
398  * possible display sizes; it is numsizes*2 words long. The function will
399  * zero out any invalid x,y size pairs. The return value is the number of
400  * valid sizes that were found.
401  *
402  * Note this doesn't guarantee a resize attempt will work; you still need to
403  * check the return value.
404  *
405  * (It might be better to implement some sort of query interface that returns
406  * an array of supported sizes, but this way is somewhat simpler and will do
407  * the job on most cards, assuming they handle the std sizes the app knows
408  * about.)
409  */
411 verify_window_sizes(int numsizes, int *dimen) {
412  return numsizes;
413 }
414 
415 /**
416  * This is called by the GraphicsEngine to request that the window (or
417  * whatever) open itself or, in general, make itself valid, at the next call
418  * to process_events().
419  */
420 void GraphicsWindow::
422  WindowProperties open_properties;
423  open_properties.set_open(true);
424  request_properties(open_properties);
425 }
426 
427 /**
428  * This is called by the GraphicsEngine to request that the window (or
429  * whatever) close itself or, in general, make itself invalid, at the next
430  * call to process_events(). By that time we promise the gsg pointer will be
431  * cleared.
432  */
433 void GraphicsWindow::
435  WindowProperties close_properties;
436  close_properties.set_open(false);
437  request_properties(close_properties);
438 }
439 
440 /**
441  * This is called by the GraphicsEngine to insist that the window be closed
442  * immediately. This is only called from the window thread.
443  */
444 void GraphicsWindow::
446  WindowProperties close_properties;
447  close_properties.set_open(false);
448  set_properties_now(close_properties);
449 }
450 
451 /**
452  * Do whatever processing is necessary to ensure that the window responds to
453  * user events. Also, honor any requests recently made via
454  * request_properties().
455  *
456  * This function is called only within the window thread.
457  */
458 void GraphicsWindow::
460  if (_requested_properties.is_any_specified()) {
461  // We don't bother to grab the mutex until after we have already checked
462  // whether any properties have been specified. This is technically
463  // sloppy, but it ought to be o.k. since it's just a bitmask after all.
464  WindowProperties properties;
465  {
466  LightReMutexHolder holder(_properties_lock);
467  properties = _requested_properties;
468  _requested_properties.clear();
469 
470  set_properties_now(properties);
471  if (properties.is_any_specified()) {
472  display_cat.info()
473  << "Unable to set window properties: " << properties << "\n";
474  _rejected_properties.add_properties(properties);
475  }
476  }
477  }
478 }
479 
480 /**
481  * Applies the requested set of properties to the window, if possible, for
482  * instance to request a change in size or minimization status.
483  *
484  * The window properties are applied immediately, rather than waiting until
485  * the next frame. This implies that this method may *only* be called from
486  * within the window thread.
487  *
488  * The properties that have been applied are cleared from the structure by
489  * this function; so on return, whatever remains in the properties structure
490  * are those that were unchanged for some reason (probably because the
491  * underlying interface does not support changing that property on an open
492  * window).
493  */
494 void GraphicsWindow::
496  if (properties.has_open() &&
497  properties.get_open() != _properties.get_open()) {
498  // Open or close a new window. In this case we can get all of the
499  // properties at once.
500 
501  _properties.add_properties(properties);
502  properties.clear();
503 
504  if (_properties.get_open()) {
505  if (open_window()) {
506  // When the window is first opened, force its size to be broadcast to
507  // its display regions.
508  _is_valid = true;
509  set_size_and_recalc(_properties.get_x_size(),
510  _properties.get_y_size());
511  } else {
512  // Since we can't even open the window, tag the _rejected_properties
513  // with all of the window properties that failed.
514  _rejected_properties.add_properties(_properties);
515 
516  // And mark the window closed.
517  _properties.set_open(false);
518  _is_valid = false;
519  }
520 
521  } else {
522  // We used to resist closing a window before its GSG has been released.
523  // Now it seems we never release a GSG, so go ahead and close the
524  // window.
525  close_window();
526  _is_valid = false;
527  }
528  return;
529  }
530 
531  if (!_properties.get_open()) {
532  // The window is not currently open; we can set properties at will.
533  _properties.add_properties(properties);
534  properties.clear();
535  return;
536  }
537 
538  properties.clear_open();
539 
540  // The window is already open; we are limited to what we can change on the
541  // fly.
542 
543  if (properties.has_size() || properties.has_origin()) {
544  // Consider changing the window's size andor position.
545  WindowProperties reshape_props;
546  if (properties.has_size()) {
547  reshape_props.set_size(properties.get_x_size(), properties.get_y_size());
548  } else {
549  reshape_props.set_size(_properties.get_x_size(), _properties.get_y_size());
550  }
551 
552  if (properties.has_origin() && !is_fullscreen()) {
553  reshape_props.set_origin(properties.get_x_origin(), properties.get_y_origin());
554  } else if (_properties.has_origin()) {
555  reshape_props.set_origin(_properties.get_x_origin(), _properties.get_y_origin());
556  }
557 
558  bool has_origin = reshape_props.has_origin();
559  int x_origin = 0, y_origin = 0;
560  if (has_origin) {
561  x_origin = reshape_props.get_x_origin();
562  y_origin = reshape_props.get_y_origin();
563  }
564 
565  if (reshape_props.get_x_size() != _properties.get_x_size() ||
566  reshape_props.get_y_size() != _properties.get_y_size() ||
567  (has_origin && (x_origin != _properties.get_x_origin() ||
568  y_origin != _properties.get_y_origin()))) {
569  if (do_reshape_request(x_origin, y_origin, has_origin,
570  reshape_props.get_x_size(),
571  reshape_props.get_y_size())) {
572  properties.clear_size();
573  properties.clear_origin();
574  }
575  } else {
576  properties.clear_size();
577  properties.clear_origin();
578  }
579  }
580 
581  if (properties.has_fullscreen() &&
582  properties.get_fullscreen() == _properties.get_fullscreen()) {
583  // Fullscreen property specified, but unchanged.
584  properties.clear_fullscreen();
585  }
586  if (properties.has_mouse_mode() &&
587  properties.get_mouse_mode() == _properties.get_mouse_mode()) {
588  // Mouse mode specified, but unchanged.
589  properties.clear_mouse_mode();
590  }
591 }
592 
593 /**
594  * Closes the window right now. Called from the window thread.
595  */
596 void GraphicsWindow::
597 close_window() {
598  display_cat.info()
599  << "Closing " << get_type() << "\n";
600 
601  // Tell our parent window (if any) that we're no longer its child.
602  if (_window_handle != nullptr &&
603  _parent_window_handle != nullptr) {
604  _parent_window_handle->detach_child(_window_handle);
605  }
606 
607  _window_handle = nullptr;
608  _parent_window_handle = nullptr;
609  _is_valid = false;
610 }
611 
612 /**
613  * Opens the window right now. Called from the window thread. Returns true
614  * if the window is successfully opened, or false if there was a problem.
615  */
616 bool GraphicsWindow::
617 open_window() {
618  return false;
619 }
620 
621 /**
622  * resets the window framebuffer from its derived children. Does nothing
623  * here.
624  */
625 void GraphicsWindow::
626 reset_window(bool swapchain) {
627  display_cat.info()
628  << "Resetting " << get_type() << "\n";
629 }
630 
631 /**
632  * Called from the window thread in response to a request from within the code
633  * (via request_properties()) to change the size and/or position of the
634  * window. Returns true if the window is successfully changed, or false if
635  * there was a problem.
636  */
637 bool GraphicsWindow::
638 do_reshape_request(int x_origin, int y_origin, bool has_origin,
639  int x_size, int y_size) {
640  return false;
641 }
642 
643 /**
644  * Should be called (from within the window thread) when process_events()
645  * detects an external change in some important window property; for instance,
646  * when the user resizes the window.
647  */
648 void GraphicsWindow::
649 system_changed_properties(const WindowProperties &properties) {
650  if (display_cat.is_debug()) {
651  display_cat.debug()
652  << "system_changed_properties(" << properties << ")\n";
653  }
654 
655  LightReMutexHolder holder(_properties_lock);
656 
657  if (properties.has_size()) {
658  system_changed_size(properties.get_x_size(), properties.get_y_size());
659  }
660 
661  WindowProperties old_properties = _properties;
662  _properties.add_properties(properties);
663  if (_properties != old_properties) {
664  throw_event(_window_event, this);
665  }
666 }
667 
668 /**
669  * An internal function to update all the DisplayRegions with the new size of
670  * the window. This should always be called before changing the _size members
671  * of the _properties structure.
672  */
673 void GraphicsWindow::
674 system_changed_size(int x_size, int y_size) {
675  if (display_cat.is_debug()) {
676  display_cat.debug()
677  << "system_changed_size(" << x_size << ", " << y_size << ")\n";
678  }
679 
680  if (!_properties.has_size() || (x_size != _properties.get_x_size() ||
681  y_size != _properties.get_y_size())) {
682  set_size_and_recalc(x_size, y_size);
683  }
684 }
685 
686 /**
687  * Adds a GraphicsWindowInputDevice to the vector. Returns the index of the
688  * new device.
689  */
690 int GraphicsWindow::
691 add_input_device(InputDevice *device) {
692  LightMutexHolder holder(_input_lock);
693  int index = (int)_input_devices.size();
694  _input_devices.push_back(device);
695  return index;
696 }
697 
698 /**
699  * detaches mouse. Only mouse delta from now on.
700  *
701  */
702 void GraphicsWindow::
703 mouse_mode_relative() {
704 }
705 
706 /**
707  * reattaches mouse to location
708  *
709  */
710 void GraphicsWindow::
711 mouse_mode_absolute() {
712 
713 }
714 
715 /**
716  * Returns whether the specified event msg is a touch message.
717  *
718  */
719 bool GraphicsWindow::
721  return false;
722 }
723 
724 /**
725  * Returns the current number of touches on this window.
726  *
727  */
730  return 0;
731 }
732 
733 /**
734  * Returns the TouchInfo object describing the specified touch.
735  *
736  */
738 get_touch_info(int index){
739  return TouchInfo();
740 }
741 
742 /**
743  * Returns whether this window supports adding of Windows proc handlers.
744  *
745  */
747  return false;
748 }
bool has_keyboard(int device) const
Returns true if the nth input device has a keyboard, false otherwise.
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
This specialization on CallbackData is passed when the callback is initiated from from an implementat...
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
get_mouse_mode
See set_mouse_mode().
get_input_device
Returns the nth input device associated with the window.
void set_size_and_recalc(int x, int y)
Changes the x_size and y_size, then recalculates structures that depend on size.
void clear()
Unsets all properties that have been specified so far, and resets the WindowProperties structure to i...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void close_ime()
Forces the ime window to close if any.
get_open
Returns true if the window is open.
set_size
Specifies the requested size of the window, in pixels.
virtual bool move_pointer(int device, int x, int y)
Forces the pointer to the indicated position within the window, if possible.
virtual int get_num_touches()
Returns the current number of touches on this window.
is_active
Returns true if the window is ready to be rendered into, false otherwise.
BEGIN_PUBLISH typedef PointerData MouseData
Deprecated alias for PointerData.
Definition: mouseData.h:23
virtual MouseData get_pointer(int device) const
See GraphicsWindowInputDevice::enable_pointer_mode.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
set_window_event
Changes the name of the event that is generated when this window is modified externally,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void request_properties(const WindowProperties &requested_properties)
Requests a property change on the window.
clear_origin
Removes the origin specification from the properties.
int get_y_origin() const
Returns the y coordinate of the window's top-left corner, not including decorations.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void request_close()
This is called by the GraphicsEngine to request that the window (or whatever) close itself or,...
clear_open
Removes the open specification from the properties.
has_fullscreen
Returns true if set_fullscreen() has been specified.
virtual bool is_active() const
Returns true if the window is ready to be rendered into, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
has_open
Returns true if set_open() has been specified.
has_origin
Returns true if the window origin has been specified, false otherwise.
Stores information for a single touch event.
Definition: touchInfo.h:22
set_origin
Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window s...
set_close_request_event
Sets the event that is triggered when the user requests to close the window, e.g.
This is a structure representing a single input device.
Definition: inputDevice.h:53
Similar to MutexHolder, but for a light mutex.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
virtual bool supports_window_procs() const
Returns whether this window supports adding of Windows proc handlers.
clear_mouse_mode
Removes the mouse_mode specification from the properties.
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e....
This is a virtual input device that represents the keyboard and mouse pair that is associated with a ...
This is a base class for the various different classes that represent the result of a frame of render...
Similar to MutexHolder, but for a light reentrant mutex.
get_minimized
Returns true if the window is minimized.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_size
Returns size in pixels of the useful part of the window, not including decorations.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
Definition: memoryUsage.I:55
clear_fullscreen
Removes the fullscreen specification from the properties.
virtual TouchInfo get_touch_info(int index)
Returns the TouchInfo object describing the specified touch.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_input_device_name
Returns the name of the nth input device.
void add_properties(const WindowProperties &other)
Sets any properties that are explicitly specified in other on this object.
void enable_pointer_events(int device)
Turn on the generation of pointer events.
virtual void set_close_now()
This is called by the GraphicsEngine to insist that the window be closed immediately.
Encapsulates all the communication with a particular instance of a given rendering backend.
void clear_rejected_properties()
Empties the set of failed properties that will be returned by get_rejected_properties().
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
This class is the main interface to controlling the render process.
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
virtual bool is_touch_event(GraphicsWindowProcCallbackData *callbackData)
Returns whether the specified event msg is a touch message.
get_fullscreen
Returns true if the window is in fullscreen mode.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
void disable_pointer_events(int device)
Turn off the generation of pointer events.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
bool is_fullscreen() const
Returns true if the window has been opened as a fullscreen window, false otherwise.
set_open
Specifies whether the window should be open.
int get_x_origin() const
Returns the x coordinate of the window's top-left corner, not including decorations.
clear_size
Removes the size specification from the properties.
This class represents a map containing all of the buttons of a (keyboard) device, though it can also ...
Definition: buttonMap.h:30
has_size
Returns true if the window size has been specified, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_pointer(int device) const
Returns true if the nth input device has a screen-space pointer (for instance, a mouse),...
virtual void request_open()
This is called by the GraphicsEngine to request that the window (or whatever) open itself or,...