1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
19 //! The display instance for the library
20 extern Display *display;
22 //! Manages a single X11 display.
29 //! Does the display have the XKB extension?
31 //! Base for events for the XKB extension
34 //! Does the display have the Shape extension?
36 //! Base for events for the Shape extension
37 int _shape_event_basep;
39 //! Does the display have the Xinerama extension?
41 //! Base for events for the Xinerama extension
42 int _xinerama_event_basep;
44 //! A list of all possible combinations of keyboard lock masks
45 unsigned int _mask_list[8];
47 //! The value of the mask for the NumLock modifier
48 unsigned int _num_lock_mask;
50 //! The value of the mask for the ScrollLock modifier
51 unsigned int _scroll_lock_mask;
53 //! The number of requested grabs on the display
56 //! A list of information for all screens on the display
57 std::vector<ScreenInfo> _screenInfoList;
59 //! A list of RenderControl objects, which are used for all graphics on a
61 std::vector<RenderControl*> _renderControlList;
63 //! A cache for re-using GCs, used by the drawing objects
73 // Handles X errors on the display
75 Displays the error if compiled for debugging.
77 //int xerrorHandler(::Display *d, XErrorEvent *e);
80 //! Initializes the class, opens the X display
82 The DISPLAY environment variable is used to choose the display.
86 //! Destroys the class, closes the X display
89 //! Returns the GC cache for the application
90 inline GCCache *gcCache() const { return _gccache; }
92 //! Gets information on a specific screen
94 Returns a ScreenInfo class, which contains information for a screen on the
96 @param snum The screen number of the screen to retrieve info on
97 @return Info on the requested screen, in a ScreenInfo class
99 const ScreenInfo* screenInfo(int snum);
101 //! Find a ScreenInfo based on a root window
102 const ScreenInfo* findScreen(Window root);
104 //! Gets the RenderControl for a screen
105 const RenderControl *renderControl(int snum);
107 //! Returns if the display has the xkb extension available
108 inline bool xkb() const { return _xkb; }
109 //! Returns the xkb extension's event base
110 inline int xkbEventBase() const { return _xkb_event_basep; }
112 //! Returns if the display has the shape extension available
113 inline bool shape() const { return _shape; }
114 //! Returns the shape extension's event base
115 inline int shapeEventBase() const { return _shape_event_basep; }
116 //! Returns if the display has the xinerama extension available
117 inline bool xinerama() const { return _xinerama; }
119 inline unsigned int numLockMask() const { return _num_lock_mask; }
120 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
122 inline ::Display* operator*() const { return _display; }
124 //! Grabs the display
127 //! Ungrabs the display
133 void grabButton(unsigned int button, unsigned int modifiers,
134 Window grab_window, bool owner_events,
135 unsigned int event_mask, int pointer_mode,
136 int keyboard_mode, Window confine_to, Cursor cursor,
137 bool allow_scroll_lock) const;
138 void ungrabButton(unsigned int button, unsigned int modifiers,
139 Window grab_window) const;
140 void grabKey(unsigned int keycode, unsigned int modifiers,
141 Window grab_window, bool owner_events,
142 int pointer_mode, int keyboard_mode,
143 bool allow_scroll_lock) const;
144 void ungrabKey(unsigned int keycode, unsigned int modifiers,
145 Window grab_window) const;
150 #endif // __display_hh