1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
15 //! The display instance for the library
16 extern Display *display;
18 //! Manages a single X11 display.
25 //! Does the display have the XKB extension?
27 //! Base for events for the XKB extension
30 //! Does the display have the Shape extension?
32 //! Base for events for the Shape extension
33 int _shape_event_basep;
35 //! Does the display have the Xinerama extension?
37 //! Base for events for the Xinerama extension
38 int _xinerama_event_basep;
40 //! A list of all possible combinations of keyboard lock masks
41 unsigned int _mask_list[8];
43 //! The value of the mask for the NumLock modifier
44 unsigned int _num_lock_mask;
46 //! The value of the mask for the ScrollLock modifier
47 unsigned int _scroll_lock_mask;
49 //! The key codes for the modifier keys
50 XModifierKeymap *_modmap;
52 //! The number of requested grabs on the display
55 //! When true, X errors will be ignored. Use with care.
58 //! The optimal visual for the display
61 //! Our colormap built for the optimal visual
64 //! The depth of our optimal visual
68 //! Wraps an open Display connection
70 @param d An open Display connection.
72 Display(::Display *d);
73 //! Destroys the class, closes the X display
76 //! Returns if the display has the xkb extension available
77 inline bool xkb() const { return _xkb; }
78 //! Returns the xkb extension's event base
79 inline int xkbEventBase() const { return _xkb_event_basep; }
81 //! Returns if the display has the shape extension available
82 inline bool shape() const { return _shape; }
83 //! Returns the shape extension's event base
84 inline int shapeEventBase() const { return _shape_event_basep; }
85 //! Returns if the display has the xinerama extension available
86 inline bool xinerama() const { return _xinerama; }
88 inline unsigned int numLockMask() const { return _num_lock_mask; }
89 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
90 const XModifierKeymap *modifierMap() const { return _modmap; }
92 inline ::Display* operator*() const { return _display; }
94 //! When true, X errors will be ignored.
95 inline bool ignoreErrors() const { return _ignore_errors; }
96 //! Set whether X errors should be ignored. Use with care.
97 void setIgnoreErrors(bool t);
102 //! Ungrabs the display
108 void grabButton(unsigned int button, unsigned int modifiers,
109 Window grab_window, bool owner_events,
110 unsigned int event_mask, int pointer_mode,
111 int keyboard_mode, Window confine_to, Cursor cursor,
112 bool allow_scroll_lock) const;
113 void ungrabButton(unsigned int button, unsigned int modifiers,
114 Window grab_window) const;
115 void grabKey(unsigned int keycode, unsigned int modifiers,
116 Window grab_window, bool owner_events,
117 int pointer_mode, int keyboard_mode,
118 bool allow_scroll_lock) const;
119 void ungrabKey(unsigned int keycode, unsigned int modifiers,
120 Window grab_window) const;
121 void ungrabAllKeys(Window grab_window) const;
126 #endif // __display_hh