Panda3D
|
Interfaces to the X11 window system. More...
#include "x11GraphicsWindow.h"
Classes | |
struct | MouseDeviceInfo |
Public Member Functions | |
x11GraphicsWindow (GraphicsEngine *engine, GraphicsPipe *pipe, const string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, GraphicsStateGuardian *gsg, GraphicsOutput *host) | |
virtual bool | begin_frame (FrameMode mode, Thread *current_thread) |
This function will be called within the draw thread before beginning rendering for a given frame. | |
virtual void | end_frame (FrameMode mode, Thread *current_thread) |
This function will be called within the draw thread after rendering is completed for a given frame. | |
virtual TypeHandle | force_init_type () |
virtual TypeHandle | get_type () const |
X11_Window | get_xwindow () const |
Returns the X11 Window handle. | |
virtual bool | move_pointer (int device, int x, int y) |
Forces the pointer to the indicated position within the window, if possible. | |
virtual void | process_events () |
Do whatever processing is necessary to ensure that the window responds to user events. | |
virtual void | set_properties_now (WindowProperties &properties) |
Applies the requested set of properties to the window, if possible, for instance to request a change in size or minimization status. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
virtual void | close_window () |
Closes the window right now. | |
ButtonHandle | get_button (XKeyEvent &key_event, bool allow_shift) |
Returns the Panda ButtonHandle corresponding to the keyboard button indicated by the given key event. | |
ButtonHandle | get_mouse_button (XButtonEvent &button_event) |
Returns the Panda ButtonHandle corresponding to the mouse button indicated by the given button event. | |
void | handle_keypress (XKeyEvent &event) |
Generates a keypress corresponding to the indicated X KeyPress event. | |
void | handle_keyrelease (XKeyEvent &event) |
Generates a keyrelease corresponding to the indicated X KeyRelease event. | |
void | handle_keystroke (XKeyEvent &event) |
Generates a keystroke corresponding to the indicated X KeyPress event. | |
ButtonHandle | map_button (KeySym key) |
Maps from a single X keysym to Panda's ButtonHandle. | |
virtual void | mouse_mode_absolute () |
Overridden from GraphicsWindow. | |
virtual void | mouse_mode_relative () |
Overridden from GraphicsWindow. | |
void | open_raw_mice () |
Adds raw mice to the _input_devices list. | |
virtual bool | open_window () |
Opens the window right now. | |
void | poll_raw_mice () |
Reads events from the raw mouse device files. | |
void | set_wm_properties (const WindowProperties &properties, bool already_mapped) |
Asks the window manager to set the appropriate properties. | |
virtual void | setup_colormap (XVisualInfo *visual) |
Allocates a colormap appropriate to the visual and stores in in the _colormap method. | |
Static Protected Member Functions | |
static Bool | check_event (X11_Display *display, XEvent *event, char *arg) |
This function is used as a predicate to XCheckIfEvent() to determine if the indicated queued X event is relevant and should be returned to this window. | |
Protected Attributes | |
bool | _awaiting_configure |
Colormap | _colormap |
bool | _dga_mouse_enabled |
X11_Display * | _display |
long | _event_mask |
XIC | _ic |
pvector< MouseDeviceInfo > | _mouse_device_info |
Atom | _net_wm_state |
Atom | _net_wm_state_above |
Atom | _net_wm_state_add |
Atom | _net_wm_state_below |
Atom | _net_wm_state_fullscreen |
Atom | _net_wm_state_remove |
Atom | _net_wm_window_type |
Atom | _net_wm_window_type_fullscreen |
Atom | _net_wm_window_type_splash |
int | _screen |
XVisualInfo * | _visual_info |
Atom | _wm_delete_window |
X11_Window | _xwindow |
Interfaces to the X11 window system.
Definition at line 33 of file x11GraphicsWindow.h.
bool x11GraphicsWindow::begin_frame | ( | FrameMode | mode, |
Thread * | current_thread | ||
) | [virtual] |
This function will be called within the draw thread before beginning rendering for a given frame.
It should do whatever setup is required, and return true if the frame should be rendered, or false if it should be skipped.
Reimplemented from GraphicsOutput.
Reimplemented in glxGraphicsWindow.
Definition at line 181 of file x11GraphicsWindow.cxx.
References GraphicsOutput::begin_frame_spam(), GraphicsOutput::clear_cube_map_selection(), and GraphicsOutput::get_fb_properties().
Bool x11GraphicsWindow::check_event | ( | X11_Display * | display, |
XEvent * | event, | ||
char * | arg | ||
) | [static, protected] |
This function is used as a predicate to XCheckIfEvent() to determine if the indicated queued X event is relevant and should be returned to this window.
Definition at line 1858 of file x11GraphicsWindow.cxx.
Referenced by process_events().
void x11GraphicsWindow::close_window | ( | ) | [protected, virtual] |
Closes the window right now.
Called from the window thread.
Reimplemented from GraphicsWindow.
Reimplemented in glxGraphicsWindow.
Definition at line 757 of file x11GraphicsWindow.cxx.
References x11GraphicsPipe::get_root().
Referenced by process_events().
void x11GraphicsWindow::end_frame | ( | FrameMode | mode, |
Thread * | current_thread | ||
) | [virtual] |
This function will be called within the draw thread after rendering is completed for a given frame.
It should do whatever finalization is required.
Reimplemented from GraphicsOutput.
Definition at line 216 of file x11GraphicsWindow.cxx.
References GraphicsOutput::clear_cube_map_selection(), GraphicsOutput::copy_to_textures(), GraphicsOutput::end_frame_spam(), and GraphicsOutput::trigger_flip().
ButtonHandle x11GraphicsWindow::get_button | ( | XKeyEvent & | key_event, |
bool | allow_shift | ||
) | [protected] |
Returns the Panda ButtonHandle corresponding to the keyboard button indicated by the given key event.
Definition at line 1429 of file x11GraphicsWindow.cxx.
References map_button(), and ButtonHandle::none().
Referenced by handle_keypress(), handle_keyrelease(), and handle_keystroke().
ButtonHandle x11GraphicsWindow::get_mouse_button | ( | XButtonEvent & | button_event | ) | [protected] |
Returns the Panda ButtonHandle corresponding to the mouse button indicated by the given button event.
Definition at line 1834 of file x11GraphicsWindow.cxx.
References MouseButton::button(), MouseButton::wheel_down(), MouseButton::wheel_left(), MouseButton::wheel_right(), and MouseButton::wheel_up().
Referenced by process_events().
X11_Window x11GraphicsWindow::get_xwindow | ( | ) | const [inline] |
Returns the X11 Window handle.
Definition at line 22 of file x11GraphicsWindow.I.
Referenced by glxGraphicsPixmap::open_buffer().
void x11GraphicsWindow::handle_keypress | ( | XKeyEvent & | event | ) | [protected] |
Generates a keypress corresponding to the indicated X KeyPress event.
Definition at line 1373 of file x11GraphicsWindow.cxx.
References get_button(), and ButtonHandle::none().
Referenced by process_events().
void x11GraphicsWindow::handle_keyrelease | ( | XKeyEvent & | event | ) | [protected] |
Generates a keyrelease corresponding to the indicated X KeyRelease event.
Definition at line 1401 of file x11GraphicsWindow.cxx.
References get_button(), and ButtonHandle::none().
Referenced by process_events().
void x11GraphicsWindow::handle_keystroke | ( | XKeyEvent & | event | ) | [protected] |
Generates a keystroke corresponding to the indicated X KeyPress event.
Definition at line 1334 of file x11GraphicsWindow.cxx.
References ButtonHandle::get_ascii_equivalent(), get_button(), and ButtonHandle::has_ascii_equivalent().
Referenced by process_events().
ButtonHandle x11GraphicsWindow::map_button | ( | KeySym | key | ) | [protected] |
Maps from a single X keysym to Panda's ButtonHandle.
Called by get_button(), above.
Definition at line 1517 of file x11GraphicsWindow.cxx.
References KeyboardButton::ascii_key(), and ButtonHandle::none().
Referenced by get_button().
void x11GraphicsWindow::mouse_mode_absolute | ( | ) | [protected, virtual] |
Overridden from GraphicsWindow.
Reimplemented from GraphicsWindow.
Definition at line 694 of file x11GraphicsWindow.cxx.
void x11GraphicsWindow::mouse_mode_relative | ( | ) | [protected, virtual] |
Overridden from GraphicsWindow.
Reimplemented from GraphicsWindow.
Definition at line 711 of file x11GraphicsWindow.cxx.
References WindowProperties::get_cursor_hidden(), and x11GraphicsPipe::get_hidden_cursor().
bool x11GraphicsWindow::move_pointer | ( | int | device, |
int | x, | ||
int | y | ||
) | [virtual] |
Forces the pointer to the indicated position within the window, if possible.
Returns true if successful, false on failure. This may fail if the mouse is not currently within the window, or if the API doesn't support this operation.
Reimplemented from GraphicsWindow.
Definition at line 140 of file x11GraphicsWindow.cxx.
References WindowProperties::get_foreground().
void x11GraphicsWindow::open_raw_mice | ( | ) | [protected] |
Adds raw mice to the _input_devices list.
Definition at line 1188 of file x11GraphicsWindow.cxx.
References GraphicsWindow::add_input_device(), and GraphicsWindowInputDevice::pointer_only().
Referenced by open_window().
bool x11GraphicsWindow::open_window | ( | ) | [protected, virtual] |
Opens the window right now.
Called from the window thread. Returns true if the window is successfully opened, or false if there was a problem.
Reimplemented from GraphicsWindow.
Reimplemented in glxGraphicsWindow.
Definition at line 808 of file x11GraphicsWindow.cxx.
References WindowProperties::get_cursor_filename(), WindowProperties::get_cursor_hidden(), WindowProperties::get_fullscreen(), x11GraphicsPipe::get_hidden_cursor(), x11GraphicsPipe::get_im(), WindowHandle::get_os_handle(), WindowProperties::get_parent_window(), WindowProperties::get_raw_mice(), x11GraphicsPipe::get_root(), WindowProperties::get_x_origin(), WindowProperties::get_x_size(), WindowProperties::get_y_origin(), WindowProperties::get_y_size(), WindowProperties::has_cursor_filename(), WindowProperties::has_origin(), WindowProperties::has_size(), TypedObject::is_of_type(), open_raw_mice(), WindowProperties::set_origin(), WindowProperties::set_size(), and set_wm_properties().
Referenced by glxGraphicsWindow::open_window().
void x11GraphicsWindow::poll_raw_mice | ( | ) | [protected] |
Reads events from the raw mouse device files.
Definition at line 1269 of file x11GraphicsWindow.cxx.
References MouseButton::button(), GraphicsWindowInputDevice::button_down(), GraphicsWindowInputDevice::button_up(), GraphicsWindowInputDevice::get_raw_pointer(), and GraphicsWindowInputDevice::set_pointer_in_window().
Referenced by process_events().
void x11GraphicsWindow::process_events | ( | ) | [virtual] |
Do whatever processing is necessary to ensure that the window responds to user events.
Also, honor any requests recently made via request_properties()
This function is called only within the window thread.
Reimplemented from GraphicsWindow.
Definition at line 244 of file x11GraphicsWindow.cxx.
References check_event(), close_window(), GraphicsWindow::get_close_request_event(), WindowProperties::get_fixed_size(), get_mouse_button(), GraphicsWindow::get_properties(), WindowProperties::get_x_size(), WindowProperties::get_y_size(), handle_keypress(), handle_keyrelease(), handle_keystroke(), poll_raw_mice(), WindowProperties::set_foreground(), WindowProperties::set_minimized(), WindowProperties::set_open(), WindowProperties::set_origin(), WindowProperties::set_size(), and GraphicsWindow::system_changed_properties().
void x11GraphicsWindow::set_properties_now | ( | WindowProperties & | properties | ) | [virtual] |
Applies the requested set of properties to the window, if possible, for instance to request a change in size or minimization status.
The window properties are applied immediately, rather than waiting until the next frame. This implies that this method may *only* be called from within the window thread.
The return value is true if the properties are set, false if they are ignored. This is mainly useful for derived classes to implement extensions to this function.
Reimplemented from GraphicsWindow.
Definition at line 470 of file x11GraphicsWindow.cxx.
References WindowProperties::add_properties(), WindowProperties::clear_cursor_filename(), WindowProperties::clear_cursor_hidden(), WindowProperties::clear_foreground(), WindowProperties::clear_fullscreen(), WindowProperties::clear_origin(), WindowProperties::clear_size(), WindowProperties::clear_title(), WindowProperties::clear_z_order(), WindowProperties::get_cursor_filename(), WindowProperties::get_cursor_hidden(), GraphicsPipe::get_display_height(), GraphicsPipe::get_display_width(), WindowProperties::get_foreground(), WindowProperties::get_fullscreen(), x11GraphicsPipe::get_hidden_cursor(), x11GraphicsPipe::get_root(), WindowProperties::get_title(), WindowProperties::get_x_origin(), WindowProperties::get_x_size(), WindowProperties::get_y_origin(), WindowProperties::get_y_size(), WindowProperties::get_z_order(), WindowProperties::has_cursor_filename(), WindowProperties::has_cursor_hidden(), WindowProperties::has_foreground(), WindowProperties::has_fullscreen(), WindowProperties::has_origin(), WindowProperties::has_size(), WindowProperties::has_title(), WindowProperties::has_z_order(), WindowProperties::is_any_specified(), WindowProperties::set_cursor_filename(), WindowProperties::set_cursor_hidden(), WindowProperties::set_fullscreen(), WindowProperties::set_origin(), WindowProperties::set_size(), WindowProperties::set_title(), set_wm_properties(), and WindowProperties::set_z_order().
void x11GraphicsWindow::set_wm_properties | ( | const WindowProperties & | properties, |
bool | already_mapped | ||
) | [protected] |
Asks the window manager to set the appropriate properties.
In X, these properties cannot be specified directly by the application; they must be requested via the window manager, which may or may not choose to honor the request.
If already_mapped is true, the window has already been mapped (manifested) on the display. This means we may need to use a different action in some cases.
Definition at line 970 of file x11GraphicsWindow.cxx.
References WindowProperties::get_fixed_size(), WindowProperties::get_fullscreen(), WindowProperties::get_minimized(), x11GraphicsPipe::get_root(), WindowProperties::get_title(), WindowProperties::get_undecorated(), WindowProperties::get_x_origin(), WindowProperties::get_x_size(), WindowProperties::get_y_origin(), WindowProperties::get_y_size(), WindowProperties::get_z_order(), WindowProperties::has_minimized(), WindowProperties::has_origin(), WindowProperties::has_size(), WindowProperties::has_title(), and WindowProperties::has_z_order().
Referenced by open_window(), and set_properties_now().
void x11GraphicsWindow::setup_colormap | ( | XVisualInfo * | visual | ) | [protected, virtual] |
Allocates a colormap appropriate to the visual and stores in in the _colormap method.
Definition at line 1173 of file x11GraphicsWindow.cxx.
References x11GraphicsPipe::get_root().