1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
16 //! The display instance for the library
17 extern Display *display;
19 //! Manages a single X11 display.
26 //! Does the display have the XKB extension?
28 //! Base for events for the XKB extension
31 //! Does the display have the Shape extension?
33 //! Base for events for the Shape extension
34 int _shape_event_basep;
36 //! Does the display have the Xinerama extension?
38 //! Base for events for the Xinerama extension
39 int _xinerama_event_basep;
41 //! A list of all possible combinations of keyboard lock masks
42 unsigned int _mask_list[8];
44 //! The value of the mask for the NumLock modifier
45 unsigned int _num_lock_mask;
47 //! The value of the mask for the ScrollLock modifier
48 unsigned int _scroll_lock_mask;
50 //! The key codes for the modifier keys
51 XModifierKeymap *_modmap;
53 //! The number of requested grabs on the display
56 //! When true, X errors will be ignored. Use with care.
59 //! A list of information for all screens on the display
60 ScreenInfo** _screeninfo_list;
62 //! A list of RenderControl objects, which are used for all graphics on a
64 RenderControl** _rendercontrol_list;
67 //! Initializes the class, opens the X display
69 The DISPLAY environment variable is used to choose the display.
73 //! Destroys the class, closes the X display
76 //! Gets information on a specific screen
78 Returns a ScreenInfo class, which contains information for a screen on the
80 @param snum The screen number of the screen to retrieve info on
81 @return Info on the requested screen, in a ScreenInfo class
83 const ScreenInfo* screenInfo(int snum) const;
85 //! Find a ScreenInfo based on a root window
86 const ScreenInfo* findScreen(Window root) const;
88 //! Gets the RenderControl for a screen
89 const RenderControl *renderControl(int snum) const;
91 //! Returns if the display has the xkb extension available
92 inline bool xkb() const { return _xkb; }
93 //! Returns the xkb extension's event base
94 inline int xkbEventBase() const { return _xkb_event_basep; }
96 //! Returns if the display has the shape extension available
97 inline bool shape() const { return _shape; }
98 //! Returns the shape extension's event base
99 inline int shapeEventBase() const { return _shape_event_basep; }
100 //! Returns if the display has the xinerama extension available
101 inline bool xinerama() const { return _xinerama; }
103 inline unsigned int numLockMask() const { return _num_lock_mask; }
104 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
105 const XModifierKeymap *modifierMap() const { return _modmap; }
107 inline ::Display* operator*() const { return _display; }
109 //! When true, X errors will be ignored.
110 inline bool ignoreErrors() const { return _ignore_errors; }
111 //! Set whether X errors should be ignored. Use with care.
112 void setIgnoreErrors(bool t);
114 //! Grabs the display
117 //! Ungrabs the display
123 void grabButton(unsigned int button, unsigned int modifiers,
124 Window grab_window, bool owner_events,
125 unsigned int event_mask, int pointer_mode,
126 int keyboard_mode, Window confine_to, Cursor cursor,
127 bool allow_scroll_lock) const;
128 void ungrabButton(unsigned int button, unsigned int modifiers,
129 Window grab_window) const;
130 void grabKey(unsigned int keycode, unsigned int modifiers,
131 Window grab_window, bool owner_events,
132 int pointer_mode, int keyboard_mode,
133 bool allow_scroll_lock) const;
134 void ungrabKey(unsigned int keycode, unsigned int modifiers,
135 Window grab_window) const;
140 #endif // __display_hh