Panda3D
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
x11GraphicsWindow Class Reference

Interfaces to the X11 window system. More...

#include "x11GraphicsWindow.h"

Inheritance diagram for x11GraphicsWindow:
GraphicsWindow GraphicsOutput GraphicsOutputBase DrawableRegion TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase glxGraphicsWindow

List of all members.

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
bool _have_xrandr
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

Detailed Description

Interfaces to the X11 window system.

Definition at line 33 of file x11GraphicsWindow.h.


Member Function Documentation

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 187 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 1874 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 765 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 222 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 1445 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 1850 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 1389 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 1417 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 1350 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 1533 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 702 of file x11GraphicsWindow.cxx.

void x11GraphicsWindow::mouse_mode_relative ( ) [protected, virtual]

Overridden from GraphicsWindow.

Reimplemented from GraphicsWindow.

Definition at line 719 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 146 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 1204 of file x11GraphicsWindow.cxx.

References GraphicsWindow::add_input_device(), and GraphicsWindowInputDevice::pointer_only().

Referenced by open_window().

bool x11GraphicsWindow::open_window ( ) [protected, virtual]
void x11GraphicsWindow::poll_raw_mice ( ) [protected]
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 476 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 978 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 1189 of file x11GraphicsWindow.cxx.

References x11GraphicsPipe::get_root().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations