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);
59 request_properties(WindowProperties::get_default());
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();
88 get_properties()
const {
103 get_requested_properties()
const {
107 result = _requested_properties;
119 _rejected_properties.
clear();
129 get_rejected_properties()
const {
133 result = _rejected_properties;
151 if (!_has_size && _requested_properties.
has_size()) {
156 _size = _requested_properties.
get_size();
182 _window_event = window_event;
190 string GraphicsWindow::
191 get_window_event()
const {
194 result = _window_event;
218 _close_request_event = close_request_event;
226 string GraphicsWindow::
227 get_close_request_event()
const {
230 result = _close_request_event;
241 get_num_input_devices()
const {
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() {
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...
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.
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.
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.
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.
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 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.
clear_fullscreen
Removes the fullscreen specification from the properties.
virtual TouchInfo get_touch_info(int index)
Returns the TouchInfo object describing the specified touch.
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.
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.
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,...