]> icculus.org git repositories - mikachu/openbox.git/blob - src/screen.hh
not using any old blackbox classes anymore!
[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 #include "otk/style.hh"
18 #include "otk/configuration.hh" // TEMPORARY
19
20 #include <string>
21
22 namespace ob {
23
24 class OBClient;
25
26 //! Manages a single screen
27 /*!
28 */
29 class OBScreen {
30 public:
31   //! Holds a list of OBClient objects
32   typedef std::vector<OBClient*> ClientList;
33   //! Holds a list of otk::Strut objects
34   typedef std::list<otk::Strut*> StrutList;
35
36   static const unsigned long event_mask = ColormapChangeMask |
37                                           EnterWindowMask |
38                                           LeaveWindowMask |
39                                           PropertyChangeMask |
40                                           SubstructureNotifyMask |
41                                           SubstructureRedirectMask |
42                                           ButtonPressMask |
43                                           ButtonReleaseMask;
44
45 private:
46   //! Was %Openbox able to manage the screen?
47   bool _managed;
48
49   //! The number of the screen on the X server
50   int _number;
51
52   //! Information about this screen
53   const otk::ScreenInfo *_info;
54   
55   //! The Image Control used for rendering on the screen
56   otk::BImageControl *_image_control;
57
58   //! The style with which to render on the screen
59   otk::Style _style;
60
61   //! Is the root colormap currently installed?
62   bool _root_cmap_installed;
63
64   //! The dimentions of the screen
65   otk::Point _size;
66
67   //! All managed clients on the screen
68   ClientList _clients;
69
70   //! Area usable for placement etc (total - struts)
71   otk::Rect _area;
72
73   //! Areas of the screen reserved by applications
74   StrutList _struts;
75
76
77   //! Manage any pre-existing windows on the screen
78   void manageExisting();
79   //! Calculate the OBScreen::_area member
80   void calcArea();
81   //! Set the client list on the root window
82   /*!
83     Sets the _NET_CLIENT_LIST root window property.<br>
84     Also calls OBScreen::updateStackingList.
85   */
86   void setClientList();
87   //! Set the client stacking list on the root window
88   /*!
89     Set the _NET_CLIENT_LIST_STACKING root window property.
90   */
91   void setStackingList();
92   //! Set the work area hint on the root window
93   /*!
94     Set the _NET_WORKAREA root window property.
95   */
96   void setWorkArea();
97   
98 public:
99   //! Constructs a new OBScreen object
100   OBScreen(int screen);
101   //! Destroys the OBScreen object
102   virtual ~OBScreen();
103
104   //! Returns the Image Control used for rendering on the screen
105   inline otk::BImageControl *imageControl() { return _image_control; }
106   //! Returns the dimentions of the screen
107   inline const otk::Point &size() const { return _size; }
108   //! Returns the area of the screen not reserved by applications' Struts
109   inline const otk::Rect &area() const { return _area; }
110
111   //! Adds a window's strut to the screen's list of reserved spaces
112   void addStrut(otk::Strut *strut);
113   //! Removes a window's strut from the screen's list of reserved spaces
114   void removeStrut(otk::Strut *strut);
115
116   //! Loads a new style on the screen
117   void loadStyle(const otk::Configuration &config);
118
119   inline const otk::Style *style() const { return &_style; }
120 };
121
122 }
123
124 #endif// __screen_hh