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 //! A list of information for all screens on the display
57 ScreenInfo** _screeninfo_list;
59 //! A list of RenderControl objects, which are used for all graphics on a
61 RenderControl** _rendercontrol_list;
63 // Handles X errors on the display
65 Displays the error if compiled for debugging.
67 //int xerrorHandler(::Display *d, XErrorEvent *e);
70 //! Initializes the class, opens the X display
72 The DISPLAY environment variable is used to choose the display.
76 //! Destroys the class, closes the X display
79 //! Gets information on a specific screen
81 Returns a ScreenInfo class, which contains information for a screen on the
83 @param snum The screen number of the screen to retrieve info on
84 @return Info on the requested screen, in a ScreenInfo class
86 const ScreenInfo* screenInfo(int snum) const;
88 //! Find a ScreenInfo based on a root window
89 const ScreenInfo* findScreen(Window root) const;
91 //! Gets the RenderControl for a screen
92 const RenderControl *renderControl(int snum) const;
94 //! Returns if the display has the xkb extension available
95 inline bool xkb() const { return _xkb; }
96 //! Returns the xkb extension's event base
97 inline int xkbEventBase() const { return _xkb_event_basep; }
99 //! Returns if the display has the shape extension available
100 inline bool shape() const { return _shape; }
101 //! Returns the shape extension's event base
102 inline int shapeEventBase() const { return _shape_event_basep; }
103 //! Returns if the display has the xinerama extension available
104 inline bool xinerama() const { return _xinerama; }
106 inline unsigned int numLockMask() const { return _num_lock_mask; }
107 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
108 const XModifierKeymap *modifierMap() const { return _modmap; }
110 inline ::Display* operator*() const { return _display; }
112 //! Grabs the display
115 //! Ungrabs the display
121 void grabButton(unsigned int button, unsigned int modifiers,
122 Window grab_window, bool owner_events,
123 unsigned int event_mask, int pointer_mode,
124 int keyboard_mode, Window confine_to, Cursor cursor,
125 bool allow_scroll_lock) const;
126 void ungrabButton(unsigned int button, unsigned int modifiers,
127 Window grab_window) const;
128 void grabKey(unsigned int keycode, unsigned int modifiers,
129 Window grab_window, bool owner_events,
130 int pointer_mode, int keyboard_mode,
131 bool allow_scroll_lock) const;
132 void ungrabKey(unsigned int keycode, unsigned int modifiers,
133 Window grab_window) const;
138 #endif // __display_hh