1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
18 //! The display instance for the library
19 extern Display
*display
;
21 //! Manages a single X11 display.
23 This class is static, and cannot be instantiated.
24 Use the initialize() method to open the display and ready it for use.
25 Use the destroy() method to close it and clean up the class' data.
30 //! A List of ScreenInfo instances
31 typedef std::vector
<ScreenInfo
> ScreenInfoList
;
37 //! Does the display have the XKB extension?
39 //! Base for events for the XKB extension
42 //! Does the display have the Shape extension?
44 //! Base for events for the Shape extension
45 int _shape_event_basep
;
47 //! Does the display have the Xinerama extension?
49 //! Base for events for the Xinerama extension
50 int _xinerama_event_basep
;
52 //! A list of all possible combinations of keyboard lock masks
53 unsigned int _mask_list
[8];
55 //! The value of the mask for the NumLock modifier
56 unsigned int _num_lock_mask
;
58 //! The value of the mask for the ScrollLock modifier
59 unsigned int _scroll_lock_mask
;
61 //! The number of requested grabs on the display
64 //! A list of information for all screens on the display
65 ScreenInfoList _screenInfoList
;
67 //! A cache for re-using GCs, used by the drawing objects
77 // Handles X errors on the display
79 Displays the error if compiled for debugging.
81 //int xerrorHandler(::Display *d, XErrorEvent *e);
84 //! Initializes the class, opens the X display
86 The DISPLAY environment variable is used to choose the display.
90 //! Destroys the class, closes the X display
93 //! Returns the GC cache for the application
94 inline GCCache
*gcCache() const { return _gccache
; }
96 //! Gets information on a specific screen
98 Returns a ScreenInfo class, which contains information for a screen on the
100 @param snum The screen number of the screen to retrieve info on
101 @return Info on the requested screen, in a ScreenInfo class
103 const ScreenInfo
* screenInfo(int snum
);
105 //! Find a ScreenInfo based on a root window
106 const ScreenInfo
* findScreen(Window root
);
108 //! Returns if the display has the xkb extension available
109 inline bool xkb() const { return _xkb
; }
110 //! Returns the xkb extension's event base
111 inline int xkbEventBase() const { return _xkb_event_basep
; }
113 //! Returns if the display has the shape extension available
114 inline bool shape() const { return _shape
; }
115 //! Returns the shape extension's event base
116 inline int shapeEventBase() const { return _shape_event_basep
; }
117 //! Returns if the display has the xinerama extension available
118 inline bool xinerama() const { return _xinerama
; }
120 inline unsigned int numLockMask() const { return _num_lock_mask
; }
121 inline unsigned int scrollLockMask() const { return _scroll_lock_mask
; }
123 inline ::Display
* operator*() const { return _display
; }
125 //! Grabs the display
128 //! Ungrabs the display
134 void grabButton(unsigned int button
, unsigned int modifiers
,
135 Window grab_window
, bool owner_events
,
136 unsigned int event_mask
, int pointer_mode
,
137 int keyboard_mode
, Window confine_to
, Cursor cursor
,
138 bool allow_scroll_lock
) const;
139 void ungrabButton(unsigned int button
, unsigned int modifiers
,
140 Window grab_window
) const;
141 void grabKey(unsigned int keycode
, unsigned int modifiers
,
142 Window grab_window
, bool owner_events
,
143 int pointer_mode
, int keyboard_mode
,
144 bool allow_scroll_lock
) const;
145 void ungrabKey(unsigned int keycode
, unsigned int modifiers
,
146 Window grab_window
) const;
151 #endif // __display_hh