]> Dogcows Code - chaz/openbox/blob - otk/display.hh
out with the blackbox source
[chaz/openbox] / otk / display.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __display_hh
3 #define __display_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 namespace otk {
10
11 class ScreenInfo;
12 class RenderControl;
13
14 class Display;
15
16 //! The display instance for the library
17 extern Display *display;
18
19 //! Manages a single X11 display.
20 class Display
21 {
22 private:
23 //! The X display
24 ::Display *_display;
25
26 //! Does the display have the XKB extension?
27 bool _xkb;
28 //! Base for events for the XKB extension
29 int _xkb_event_basep;
30
31 //! Does the display have the Shape extension?
32 bool _shape;
33 //! Base for events for the Shape extension
34 int _shape_event_basep;
35
36 //! Does the display have the Xinerama extension?
37 bool _xinerama;
38 //! Base for events for the Xinerama extension
39 int _xinerama_event_basep;
40
41 //! A list of all possible combinations of keyboard lock masks
42 unsigned int _mask_list[8];
43
44 //! The value of the mask for the NumLock modifier
45 unsigned int _num_lock_mask;
46
47 //! The value of the mask for the ScrollLock modifier
48 unsigned int _scroll_lock_mask;
49
50 //! The number of requested grabs on the display
51 int _grab_count;
52
53 //! A list of information for all screens on the display
54 ScreenInfo** _screeninfo_list;
55
56 //! A list of RenderControl objects, which are used for all graphics on a
57 //! screen
58 RenderControl** _rendercontrol_list;
59
60 // Handles X errors on the display
61 /*
62 Displays the error if compiled for debugging.
63 */
64 //int xerrorHandler(::Display *d, XErrorEvent *e);
65
66 public:
67 //! Initializes the class, opens the X display
68 /*!
69 The DISPLAY environment variable is used to choose the display.
70 @see Display::display
71 */
72 Display();
73 //! Destroys the class, closes the X display
74 ~Display();
75
76 //! Gets information on a specific screen
77 /*!
78 Returns a ScreenInfo class, which contains information for a screen on the
79 display.
80 @param snum The screen number of the screen to retrieve info on
81 @return Info on the requested screen, in a ScreenInfo class
82 */
83 const ScreenInfo* screenInfo(int snum) const;
84
85 //! Find a ScreenInfo based on a root window
86 const ScreenInfo* findScreen(Window root) const;
87
88 //! Gets the RenderControl for a screen
89 const RenderControl *renderControl(int snum) const;
90
91 //! Returns if the display has the xkb extension available
92 inline bool xkb() const { return _xkb; }
93 //! Returns the xkb extension's event base
94 inline int xkbEventBase() const { return _xkb_event_basep; }
95
96 //! Returns if the display has the shape extension available
97 inline bool shape() const { return _shape; }
98 //! Returns the shape extension's event base
99 inline int shapeEventBase() const { return _shape_event_basep; }
100 //! Returns if the display has the xinerama extension available
101 inline bool xinerama() const { return _xinerama; }
102
103 inline unsigned int numLockMask() const { return _num_lock_mask; }
104 inline unsigned int scrollLockMask() const { return _scroll_lock_mask; }
105
106 inline ::Display* operator*() const { return _display; }
107
108 //! Grabs the display
109 void grab();
110
111 //! Ungrabs the display
112 void ungrab();
113
114
115
116 /* TEMPORARY */
117 void grabButton(unsigned int button, unsigned int modifiers,
118 Window grab_window, bool owner_events,
119 unsigned int event_mask, int pointer_mode,
120 int keyboard_mode, Window confine_to, Cursor cursor,
121 bool allow_scroll_lock) const;
122 void ungrabButton(unsigned int button, unsigned int modifiers,
123 Window grab_window) const;
124 void grabKey(unsigned int keycode, unsigned int modifiers,
125 Window grab_window, bool owner_events,
126 int pointer_mode, int keyboard_mode,
127 bool allow_scroll_lock) const;
128 void ungrabKey(unsigned int keycode, unsigned int modifiers,
129 Window grab_window) const;
130 };
131
132 }
133
134 #endif // __display_hh
This page took 0.039319 seconds and 5 git commands to generate.