Go to the documentation of this file.
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")
44 #ifdef DO_MEMORY_USAGE
48 if (display_cat.is_debug()) {
50 <<
"Creating new window " << get_name() <<
"\n";
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);
60 request_properties(win_prop);
62 _window_event =
"window-event";
63 _got_expose_event =
false;
64 _unexposed_draw = win_unexposed_draw;
65 set_pixel_zoom(pixel_zoom);
75 PythonWinProcClasses::iterator iter;
76 for (iter = _python_window_proc_classes.begin();
77 iter != _python_window_proc_classes.end();
107 result = _requested_properties;
119 _rejected_properties.
clear();
133 result = _rejected_properties;
151 if (!_has_size && _requested_properties.
has_size()) {
156 _size = _requested_properties.
get_size();
182 _window_event = window_event;
194 result = _window_event;
218 _close_request_event = close_request_event;
230 result = _close_request_event;
245 result = _input_devices.size();
257 nassertr(device >= 0 && device < (
int)_input_devices.size(), NULL);
258 return _input_devices[device];
269 nassertr(device >= 0 && device < (
int)_input_devices.size(),
"");
270 result = _input_devices[device]->get_name();
284 nassertr(device >= 0 && device < (
int)_input_devices.size(),
false);
285 result = _input_devices[device]->has_pointer();
298 nassertr(device >= 0 && device < (
int)_input_devices.size(),
false);
299 result = _input_devices[device]->has_keyboard();
319 nassertv(device >= 0 && device < (
int)_input_devices.size());
320 _input_devices[device]->enable_pointer_events();
329 nassertv(device >= 0 && device < (
int)_input_devices.size());
330 _input_devices[device]->disable_pointer_events();
365 nassertr(device >= 0 && device < (
int)_input_devices.size(),
MouseData());
467 properties = _requested_properties;
468 _requested_properties.
clear();
473 <<
"Unable to set window properties: " << properties <<
"\n";
559 int x_origin = 0, y_origin = 0;
567 (has_origin && (x_origin != _properties.
get_x_origin() ||
569 if (do_reshape_request(x_origin, y_origin, has_origin,
586 if (properties.has_mouse_mode() &&
596 void GraphicsWindow::
599 <<
"Closing " << get_type() <<
"\n";
602 if (_window_handle !=
nullptr &&
603 _parent_window_handle !=
nullptr) {
604 _parent_window_handle->detach_child(_window_handle);
607 _window_handle =
nullptr;
608 _parent_window_handle =
nullptr;
616 bool GraphicsWindow::
625 void GraphicsWindow::
626 reset_window(
bool swapchain) {
628 <<
"Resetting " << get_type() <<
"\n";
637 bool GraphicsWindow::
638 do_reshape_request(
int x_origin,
int y_origin,
bool has_origin,
639 int x_size,
int y_size) {
648 void GraphicsWindow::
650 if (display_cat.is_debug()) {
652 <<
"system_changed_properties(" << properties <<
")\n";
663 if (_properties != old_properties) {
664 throw_event(_window_event,
this);
673 void GraphicsWindow::
674 system_changed_size(
int x_size,
int y_size) {
675 if (display_cat.is_debug()) {
677 <<
"system_changed_size(" << x_size <<
", " << y_size <<
")\n";
693 int index = (int)_input_devices.size();
694 _input_devices.push_back(device);
702 void GraphicsWindow::
703 mouse_mode_relative() {
710 void GraphicsWindow::
711 mouse_mode_absolute() {
get_requested_properties
Returns the properties of the window that are currently requested.
has_open
Returns true if set_open() has been specified.
Similar to MutexHolder, but for a light mutex.
get_properties
Returns the current properties of the window.
get_window_event
Returns the name of the event that is generated when this window is modified externally,...
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void enable_pointer_events(int device)
Turn on the generation of pointer events.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_size
Returns size in pixels of the useful part of the window, not including decorations.
get_rejected_properties
Returns the set of properties that have recently been requested, but could not be applied to the wind...
has_origin
Returns true if the window origin has been specified, false otherwise.
set_window_event
Changes the name of the event that is generated when this window is modified externally,...
clear_fullscreen
Removes the fullscreen specification from the properties.
set_origin
Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window s...
Similar to MutexHolder, but for a light reentrant mutex.
virtual MouseData get_pointer(int device) const
See GraphicsWindowInputDevice::enable_pointer_mode.
void set_size_and_recalc(int x, int y)
Changes the x_size and y_size, then recalculates structures that depend on size.
virtual bool is_active() const
Returns true if the window is ready to be rendered into, false otherwise.
virtual bool move_pointer(int device, int x, int y)
Forces the pointer to the indicated position within the window, if possible.
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
bool has_keyboard(int device) const
Returns true if the nth input device has a keyboard, false otherwise.
BEGIN_PUBLISH typedef PointerData MouseData
Deprecated alias for PointerData.
set_open
Specifies whether the window should be open.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
get_minimized
Returns true if the window is minimized.
virtual int get_num_touches()
Returns the current number of touches on this window.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
clear_size
Removes the size specification from the properties.
This class is the main interface to controlling the render process.
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e....
get_mouse_mode
See set_mouse_mode().
get_input_device
Returns the nth input device associated with the window.
void add_properties(const WindowProperties &other)
Sets any properties that are explicitly specified in other on this object.
virtual void request_close()
This is called by the GraphicsEngine to request that the window (or whatever) close itself or,...
TypeHandle is the identifier used to differentiate C++ class types.
virtual void close_ime()
Forces the ime window to close if any.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
This is a base class for the various different classes that represent the result of a frame of render...
set_close_request_event
Sets the event that is triggered when the user requests to close the window, e.g.
set_size
Specifies the requested size of the window, in pixels.
int get_x_origin() const
Returns the x coordinate of the window's top-left corner, not including decorations.
void request_properties(const WindowProperties &requested_properties)
Requests a property change on the window.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_fullscreen
Returns true if the window is in fullscreen mode.
get_open
Returns true if the window is open.
has_size
Returns true if the window size has been specified, false otherwise.
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
An object to create GraphicsOutputs that share a particular 3-D API.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_default
Returns the "default" WindowProperties.
void disable_pointer_events(int device)
Turn off the generation of pointer events.
get_num_input_devices
Returns the number of separate input devices associated with the window.
virtual bool is_touch_event(GraphicsWindowProcCallbackData *callbackData)
Returns whether the specified event msg is a touch message.
Stores information for a single touch event.
get_close_request_event
Returns the name of the event set via set_close_request_event().
clear_origin
Removes the origin specification from the properties.
bool has_pointer(int device) const
Returns true if the nth input device has a screen-space pointer (for instance, a mouse),...
void clear()
Unsets all properties that have been specified so far, and resets the WindowProperties structure to i...
virtual void set_close_now()
This is called by the GraphicsEngine to insist that the window be closed immediately.
virtual void request_open()
This is called by the GraphicsEngine to request that the window (or whatever) open itself or,...
virtual TouchInfo get_touch_info(int index)
Returns the TouchInfo object describing the specified touch.
void clear_rejected_properties()
Empties the set of failed properties that will be returned by get_rejected_properties().
has_fullscreen
Returns true if set_fullscreen() has been specified.
clear_open
Removes the open specification from the properties.
is_active
Returns true if the window is ready to be rendered into, false otherwise.
virtual bool supports_window_procs() const
Returns whether this window supports adding of Windows proc handlers.
Encapsulates all the communication with a particular instance of a given rendering backend.
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This specialization on CallbackData is passed when the callback is initiated from from an implementat...
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
bool is_fullscreen() const
Returns true if the window has been opened as a fullscreen window, false otherwise.
clear_mouse_mode
Removes the mouse_mode specification from the properties.
get_input_device_name
Returns the name of the nth input device.
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.