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