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