Panda3D

x11GraphicsPipe.I
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 x11GraphicsPipe.I
10 * @author drose
11 * @date 2000-10-30
12 */
13
14 /**
15 * Returns a pointer to the X display associated with the pipe: the display on
16 * which to create the windows.
17 */
18 INLINE X11_Display *x11GraphicsPipe::
19 get_display() const {
20 return _display;
21 }
22
23 /**
24 * Returns the X screen number associated with the pipe.
25 */
26 INLINE int x11GraphicsPipe::
27 get_screen() const {
28 return _screen;
29 }
30
31 /**
32 * Returns the handle to the root window on the pipe's display.
33 */
34 INLINE X11_Window x11GraphicsPipe::
35 get_root() const {
36 return _root;
37 }
38
39 /**
40 * Returns the input method opened for the pipe, or NULL if the input method
41 * could not be opened for some reason.
42 */
43 INLINE XIM x11GraphicsPipe::
44 get_im() const {
45 return _im;
46 }
47
48 /**
49 * Returns an invisible Cursor suitable for assigning to windows that have the
50 * cursor_hidden property set.
51 */
52 INLINE X11_Cursor x11GraphicsPipe::
53 get_hidden_cursor() {
54 if (_hidden_cursor == None) {
55 make_hidden_cursor();
56 }
57 return _hidden_cursor;
58 }
59
60 /**
61 * Returns true if relative mouse mode is supported on this display.
62 */
63 INLINE bool x11GraphicsPipe::
64 supports_relative_mouse() const {
65 return (_XF86DGADirectVideo != nullptr);
66 }
67
68 /**
69 * Enables relative mouse mode for this display. Returns false if unsupported.
70 */
71 INLINE bool x11GraphicsPipe::
72 enable_relative_mouse() {
73 if (_XF86DGADirectVideo != nullptr) {
74 x11display_cat.info() << "Enabling relative mouse using XF86DGA extension\n";
75 _XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse);
76 return true;
77 }
78 return false;
79 }
80
81 /**
82 * Disables relative mouse mode for this display.
83 */
84 INLINE void x11GraphicsPipe::
85 disable_relative_mouse() {
86 if (_XF86DGADirectVideo != nullptr) {
87 x11display_cat.info() << "Disabling relative mouse using XF86DGA extension\n";
88 _XF86DGADirectVideo(_display, _screen, 0);
89 }
90 }
91
92 /**
93 * Globally disables the printing of error messages that are raised by the X11
94 * system, for instance in order to test whether a particular X11 operation
95 * will succeed. Reenable error messages with a later call to
96 * enable_x_error_messages().
97 *
98 * The return value is the current value of get_x_error_count().
99 */
100 INLINE int x11GraphicsPipe::
101 disable_x_error_messages() {
102 _x_error_messages_enabled = false;
103 return _x_error_count;
104 }
105
106 /**
107 * Reenables the printing of error messages after a previous call to
108 * disable_x_error_messages().
109 *
110 * The return value is the current value of get_x_error_count().
111 */
112 INLINE int x11GraphicsPipe::
113 enable_x_error_messages() {
114 _x_error_messages_enabled = true;
115 return _x_error_count;
116 }
117
118 /**
119 * Returns the number of times an error indication has been raised by the X11
120 * system since application start, including errors raised while error
121 * messages were disabled.
122 */
123 INLINE int x11GraphicsPipe::
124 get_x_error_count() {
125 return _x_error_count;
126 }
x11GraphicsPipe::get_root
X11_Window get_root() const
Returns the handle to the root window on the pipe's display.
Definition: x11GraphicsPipe.I:35
x11GraphicsPipe::enable_x_error_messages
static int enable_x_error_messages()
Reenables the printing of error messages after a previous call to disable_x_error_messages().
Definition: x11GraphicsPipe.I:113
x11GraphicsPipe::get_display
X11_Display * get_display() const
Returns a pointer to the X display associated with the pipe: the display on which to create the windo...
Definition: x11GraphicsPipe.I:19
x11GraphicsPipe::get_screen
int get_screen() const
Returns the X screen number associated with the pipe.
Definition: x11GraphicsPipe.I:27
x11GraphicsPipe::get_im
XIM get_im() const
Returns the input method opened for the pipe, or NULL if the input method could not be opened for som...
Definition: x11GraphicsPipe.I:44
x11GraphicsPipe::supports_relative_mouse
bool supports_relative_mouse() const
Returns true if relative mouse mode is supported on this display.
Definition: x11GraphicsPipe.I:64
x11GraphicsPipe::enable_relative_mouse
bool enable_relative_mouse()
Enables relative mouse mode for this display.
Definition: x11GraphicsPipe.I:72
x11GraphicsPipe::disable_x_error_messages
static int disable_x_error_messages()
Globally disables the printing of error messages that are raised by the X11 system,...
Definition: x11GraphicsPipe.I:101
x11GraphicsPipe::get_x_error_count
static int get_x_error_count()
Returns the number of times an error indication has been raised by the X11 system since application s...
Definition: x11GraphicsPipe.I:124
x11GraphicsPipe::get_hidden_cursor
X11_Cursor get_hidden_cursor()
Returns an invisible Cursor suitable for assigning to windows that have the cursor_hidden property se...
Definition: x11GraphicsPipe.I:53
x11GraphicsPipe::disable_relative_mouse
void disable_relative_mouse()
Disables relative mouse mode for this display.
Definition: x11GraphicsPipe.I:85