]> Dogcows Code - chaz/openbox/blob - otk/display.hh
supply python routines for next/prev workspace
[chaz/openbox] / otk / display.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef __display_hh
3 #define __display_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 #include <vector>
10
11 namespace otk {
12
13 class ScreenInfo;
14 class BGCCache;
15
16 //! Manages a single X11 display.
17 /*!
18 This class is static, and cannot be instantiated.
19 Use the initialize() method to open the display and ready it for use.
20 Use the destroy() method to close it and clean up the class' data.
21 */
22 class OBDisplay
23 {
24 public:
25 //! The X display
26 static Display *display;
27
28 //! A List of ScreenInfo instances
29 typedef std::vector<ScreenInfo> ScreenInfoList;
30
31 private:
32 //! Does the display have the Shape extention?
33 static bool _shape;
34 //! Base for events for the Shape extention
35 static int _shape_event_basep;
36
37 //! Does the display have the Xinerama extention?
38 static bool _xinerama;
39 //! Base for events for the Xinerama extention
40 static int _xinerama_event_basep;
41
42 //! A list of all possible combinations of keyboard lock masks
43 static unsigned int _mask_list[8];
44
45 //! The value of the mask for the NumLock modifier
46 static unsigned int _numLockMask;
47
48 //! The value of the mask for the ScrollLock modifier
49 static unsigned int _scrollLockMask;
50
51 //! The number of requested grabs on the display
52 static int _grab_count;
53
54 //! A list of information for all screens on the display
55 static ScreenInfoList _screenInfoList;
56
57 //! A cache for re-using GCs, used by the drawing objects
58 /*!
59 @see BPen
60 @see BFont
61 @see BImage
62 @see BImageControl
63 @see BTexture
64 */
65 static BGCCache *_gccache;
66
67 //! Handles X errors on the display
68 /*!
69 Displays the error if compiled for debugging.
70 */
71 static int xerrorHandler(Display *d, XErrorEvent *e);
72
73 //! Prevents instantiation of the class
74 OBDisplay();
75
76 public:
77 //! Initializes the class, opens the X display
78 /*!
79 @see OBDisplay::display
80 @param name The name of the X display to open. If it is null, the DISPLAY
81 environment variable is used instead.
82 */
83 static void initialize(char *name);
84 //! Destroys the class, closes the X display
85 static void destroy();
86
87 //! Returns the GC cache for the application
88 inline static BGCCache *gcCache() { 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 static const ScreenInfo* screenInfo(int snum);
98
99 static const ScreenInfo* findScreen(Window root);
100
101 //! Returns if the display has the shape extention available
102 inline static bool shape() { return _shape; }
103 //! Returns the shape extension's event base
104 inline static int shapeEventBase() { return _shape_event_basep; }
105 //! Returns if the display has the xinerama extention available
106 inline static bool xinerama() { return _xinerama; }
107
108 inline static unsigned int numLockMask() { return _numLockMask; }
109 inline static unsigned int scrollLockMask() { return _scrollLockMask; }
110
111 //! Grabs the display
112 static void grab();
113
114 //! Ungrabs the display
115 static void ungrab();
116
117
118
119 /* TEMPORARY */
120 static void grabButton(unsigned int button, unsigned int modifiers,
121 Window grab_window, bool owner_events,
122 unsigned int event_mask, int pointer_mode,
123 int keyboard_mode, Window confine_to, Cursor cursor,
124 bool allow_scroll_lock);
125 static void ungrabButton(unsigned int button, unsigned int modifiers,
126 Window grab_window);
127 static void grabKey(unsigned int keycode, unsigned int modifiers,
128 Window grab_window, bool owner_events,
129 int pointer_mode, int keyboard_mode, bool allow_scroll_lock);
130 static void ungrabKey(unsigned int keycode, unsigned int modifiers,
131 Window grab_window);
132 };
133
134 }
135
136 #endif // __display_hh
This page took 0.045177 seconds and 5 git commands to generate.