]> icculus.org git repositories - mikachu/openbox.git/blob - src/screen.hh
adding the new OBScreen class actually!
[mikachu/openbox.git] / src / screen.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __screen_hh
3 #define   __screen_hh
4
5 /*! @file screen.hh
6   @brief OBScreen manages a single screen
7 */
8
9 extern "C" {
10 #include <X11/Xlib.h>
11 }
12
13 #include "otk/image.hh"
14 #include "otk/strut.hh"
15 #include "otk/rect.hh"
16 #include "otk/point.hh"
17
18 #include <string>
19
20 namespace ob {
21
22 class OBClient;
23
24 //! Manages a single screen
25 /*!
26 */
27 class OBScreen {
28 public:
29   //! Holds a list of OBClient objects
30   typedef std::vector<OBClient*> ClientList;
31   //! Holds a list of otk::Strut objects
32   typedef std::list<otk::Strut*> StrutList;
33
34   static const unsigned long event_mask = ColormapChangeMask |
35                                           EnterWindowMask |
36                                           LeaveWindowMask |
37                                           PropertyChangeMask |
38                                           SubstructureNotifyMask |
39                                           SubstructureRedirectMask |
40                                           ButtonPressMask |
41                                           ButtonReleaseMask;
42
43 private:
44   //! Was %Openbox able to manage the screen?
45   bool _managed;
46
47   //! The number of the screen on the X server
48   int _number;
49
50   //! Information about this screen
51   const otk::ScreenInfo *_info;
52   
53   //! The Image Control used for rendering on the screen
54   otk::BImageControl *_image_control;
55
56   //! Is the root colormap currently installed?
57   bool _root_cmap_installed;
58
59   //! The dimentions of the screen
60   otk::Point _size;
61
62   //! All managed clients on the screen
63   ClientList _clients;
64
65   //! Area usable for placement etc (total - struts)
66   otk::Rect _area;
67
68   //! Areas of the screen reserved by applications
69   StrutList _struts;
70
71
72   //! Manage any pre-existing windows on the screen
73   void manageExisting();
74   //! Calculate the OBScreen::_area member
75   void calcArea();
76   //! Set the client list on the root window
77   /*!
78     Sets the _NET_CLIENT_LIST root window property.<br>
79     Also calls OBScreen::updateStackingList.
80   */
81   void setClientList();
82   //! Set the client stacking list on the root window
83   /*!
84     Set the _NET_CLIENT_LIST_STACKING root window property.
85   */
86   void setStackingList();
87   //! Set the work area hint on the root window
88   /*!
89     Set the _NET_WORKAREA root window property.
90   */
91   void setWorkArea();
92   
93 public:
94   //! Constructs a new OBScreen object
95   OBScreen(int screen);
96   //! Destroys the OBScreen object
97   virtual ~OBScreen();
98
99   //! Returns the Image Control used for rendering on the screen
100   inline otk::BImageControl *imageControl() { return _image_control; }
101   //! Returns the dimentions of the screen
102   inline const otk::Point &size() const { return _size; }
103   //! Returns the area of the screen not reserved by applications' Struts
104   inline const otk::Rect &area() const { return _area; }
105
106   //! Adds a window's strut to the screen's list of reserved spaces
107   void addStrut(otk::Strut *strut);
108   //! Removes a window's strut from the screen's list of reserved spaces
109   void removeStrut(otk::Strut *strut);
110   
111 };
112
113 }
114
115 #endif// __screen_hh