]> Dogcows Code - chaz/openbox/blob - otk/display.hh
add an OBDisplay class and the old ScreenInfo class to the toolkit.
[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 class OBDisplay
17 {
18 public:
19 static Display *display; // the X display
20
21 typedef std::vector<ScreenInfo> ScreenInfoList;
22
23 private:
24 static bool _shape; // does the display have the shape extention?
25 static int _shape_event_basep; // base for shape events
26
27 static bool _xinerama; // does the display have the xinerama extention?
28 static int _xinerama_event_basep;// base for xinerama events
29
30 static unsigned int _mask_list[8];// a list of all combinations of lock masks
31
32 static ScreenInfoList _screenInfoList; // info for all screens on the display
33
34 static BGCCache *_gccache;
35
36 static int xerrorHandler(Display *d, XErrorEvent *e); // handles X errors duh
37
38 OBDisplay(); // this class cannot be instantiated
39
40 public:
41 static void initialize(char *name);
42 static void destroy();
43
44 //! Returns the GC cache for the application
45 inline static BGCCache *gcCache() { return _gccache; }
46
47 /*!
48 Returns a ScreenInfo class, which gives information on a screen on the
49 display.
50 \param snum The screen number of the screen to retrieve info on
51 \return Info on the requested screen, in a ScreenInfo class
52 */
53 inline static const ScreenInfo* screenInfo(int snum) {
54 assert(snum >= 0);
55 assert(snum < static_cast<int>(_screenInfoList.size()));
56 return &_screenInfoList[snum];
57 }
58
59 //! Returns if the display has the shape extention available
60 inline static bool shape() { return _shape; }
61 //! Returns the shape extension's event base
62 inline static int shapeEventBase() { return _shape_event_basep; }
63 //! Returns if the display has the xinerama extention available
64 inline static bool xinerama() { return _xinerama; }
65 };
66
67 }
68
69 #endif // __display_hh
This page took 0.042964 seconds and 5 git commands to generate.