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.
25 //! A List of ScreenInfo instances
26 typedef std::vector<ScreenInfo> ScreenInfoList;
32 //! Does the display have the XKB extension?
34 //! Base for events for the XKB extension
37 //! Does the display have the Shape extension?
39 //! Base for events for the Shape extension
40 int _shape_event_basep;
42 //! Does the display have the Xinerama extension?
44 //! Base for events for the Xinerama extension
45 int _xinerama_event_basep;
47 //! A list of all possible combinations of keyboard lock masks
48 unsigned int _mask_list[8];
50 //! The value of the mask for the NumLock modifier
51 unsigned int _num_lock_mask;
53 //! The value of the mask for the ScrollLock modifier
54 unsigned int _scroll_lock_mask;
56 //! The number of requested grabs on the display
59 //! A list of information for all screens on the display
60 ScreenInfoList _screenInfoList;
62 //! A cache for re-using GCs, used by the drawing objects
72 // Handles X errors on the display
74 Displays the error if compiled for debugging.
76 //int xerrorHandler(::Display *d, XErrorEvent *e);
79 //! Initializes the class, opens the X display
81 The DISPLAY environment variable is used to choose the display.
85 //! Destroys the class, closes the X display
88 //! Returns the GC cache for the application
89 inline GCCache *gcCache() const { return _gccache; }
91 //! Gets information on a specific screen
93 Returns a ScreenInfo class, which contains information for a screen on the
95 @param snum The screen number of the screen to retrieve info on
96 @return Info on the requested screen, in a ScreenInfo class
98 const ScreenInfo* screenInfo(int snum);
100 //! Find a ScreenInfo based on a root window
101 const ScreenInfo* findScreen(Window root);
103 //! Returns if the display has the xkb extension available
104 inline bool xkb() const { return _xkb; }
105 //! Returns the xkb extension's event base
106 inline int xkbEventBase() const { return _xkb_event_basep; }
108 //! Returns if the display has the shape extension available
109 inline bool shape() const { return _shape; }
110 //! Returns the shape extension's event base
111 inline int shapeEventBase() const { return _shape_event_basep; }
112 //! Returns if the display has the xinerama extension available
113 inline bool xinerama() const { return _xinerama; }
115 inline unsigned int numLockMask() const { return _num_lock_mask; }
116 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
118 inline ::Display* operator*() const { return _display; }
120 //! Grabs the display
123 //! Ungrabs the display
129 void grabButton(unsigned int button, unsigned int modifiers,
130 Window grab_window, bool owner_events,
131 unsigned int event_mask, int pointer_mode,
132 int keyboard_mode, Window confine_to, Cursor cursor,
133 bool allow_scroll_lock) const;
134 void ungrabButton(unsigned int button, unsigned int modifiers,
135 Window grab_window) const;
136 void grabKey(unsigned int keycode, unsigned int modifiers,
137 Window grab_window, bool owner_events,
138 int pointer_mode, int keyboard_mode,
139 bool allow_scroll_lock) const;
140 void ungrabKey(unsigned int keycode, unsigned int modifiers,
141 Window grab_window) const;
146 #endif // __display_hh