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::
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::
65  return (_XF86DGADirectVideo != nullptr);
66 }
67 
68 /**
69  * Enables relative mouse mode for this display. Returns false if unsupported.
70  */
71 INLINE bool x11GraphicsPipe::
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::
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::
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::
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::
125  return _x_error_count;
126 }
XIM get_im() const
Returns the input method opened for the pipe, or NULL if the input method could not be opened for som...
static int disable_x_error_messages()
Globally disables the printing of error messages that are raised by the X11 system,...
X11_Window get_root() const
Returns the handle to the root window on the pipe's display.
static int enable_x_error_messages()
Reenables the printing of error messages after a previous call to disable_x_error_messages().
void disable_relative_mouse()
Disables relative mouse mode for this display.
int get_screen() const
Returns the X screen number associated with the pipe.
X11_Cursor get_hidden_cursor()
Returns an invisible Cursor suitable for assigning to windows that have the cursor_hidden property se...
X11_Display * get_display() const
Returns a pointer to the X display associated with the pipe: the display on which to create the windo...
bool supports_relative_mouse() const
Returns true if relative mouse mode is supported on this display.
bool enable_relative_mouse()
Enables relative mouse mode for this display.
static int get_x_error_count()
Returns the number of times an error indication has been raised by the X11 system since application s...