]> icculus.org git repositories - mikachu/openbox.git/blob - src/screen.hh
gets transients! woot. tested and such.. no groups still tho
[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 "client.hh"
14 #include "rootwindow.hh"
15 #include "otk/image.hh"
16 #include "otk/strut.hh"
17 #include "otk/rect.hh"
18 #include "otk/style.hh"
19 #include "otk/configuration.hh" // TEMPORARY
20
21 #include <string>
22
23 namespace ob {
24
25 class OBClient;
26 class OBRootWindow;
27
28 //! Manages a single screen
29 /*!
30 */
31 class OBScreen {
32 public:
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   //! All managed clients on the screen (in order of being mapped)
46   OBClient::List clients;
47   
48 private:
49   //! Was %Openbox able to manage the screen?
50   bool _managed;
51
52   //! The number of the screen on the X server
53   int _number;
54
55   //! Information about this screen
56   const otk::ScreenInfo *_info;
57   
58   //! The Image Control used for rendering on the screen
59   otk::BImageControl *_image_control;
60
61   //! The style with which to render on the screen
62   otk::Style _style;
63
64   //! The screen's root window
65   OBRootWindow _root;
66   
67   //! Is the root colormap currently installed?
68   bool _root_cmap_installed;
69
70   //! Area usable for placement etc (total - struts)
71   otk::Rect _area;
72
73   //! Combined strut from all of the clients' struts
74   otk::Strut _strut;
75
76   //!  An offscreen window which gets focus when nothing else has it
77   Window _focuswindow;
78
79   //! An offscreen window which shows that a NETWM compliant window manager is
80   //! running
81   Window _supportwindow;
82
83   //! A list of all managed clients on the screen, in their stacking order
84   OBClient::List _stacking;
85
86   //! Calculate the OBScreen::_area member
87   void calcArea();
88   //! Set the list of supported NETWM atoms on the root window
89   void setSupportedAtoms();
90   //! Set the client list on the root window
91   /*!
92     Sets the _NET_CLIENT_LIST root window property.<br>
93     Also calls OBScreen::updateStackingList.
94   */
95   void setClientList();
96   //! Set the client stacking list on the root window
97   /*!
98     Set the _NET_CLIENT_LIST_STACKING root window property.
99   */
100   void setStackingList();
101   //! Set the work area hint on the root window
102   /*!
103     Set the _NET_WORKAREA root window property.
104   */
105   void setWorkArea();
106
107 public:
108 #ifndef SWIG
109   //! Constructs a new OBScreen object
110   OBScreen(int screen);
111   //! Destroys the OBScreen object
112   virtual ~OBScreen();
113 #endif
114
115   inline int number() const { return _number; }
116   
117   //! Returns if the screen was successfully managed
118   /*!
119     If this is false, then the screen should be deleted and should NOT be
120     used.
121   */
122   inline bool managed() const { return _managed; }
123   //! Returns the Image Control used for rendering on the screen
124   inline otk::BImageControl *imageControl() { return _image_control; }
125   //! Returns the area of the screen not reserved by applications' Struts
126   inline const otk::Rect &area() const { return _area; }
127   //! Returns the style in use on the screen
128   inline const otk::Style *style() const { return &_style; }
129   //!  An offscreen window which gets focus when nothing else has it
130   inline Window focuswindow() const { return _focuswindow; }
131
132   //! Update's the screen's combined strut of all the clients.
133   /*!
134     Clients should call this whenever they change their strut.
135   */
136   void updateStrut();
137
138   //! Manage any pre-existing windows on the screen
139   void manageExisting();
140   //! Manage a client window
141   /*!
142     This gives the window a frame, reparents it, selects events on it, etc.
143   */
144   void manageWindow(Window window);
145   //! Unmanage a client
146   /*!
147     This removes the window's frame, reparents it to root, unselects events on
148     it, etc.
149   */
150   void unmanageWindow(OBClient *client);
151
152   //! Raises/Lowers a client window above/below all others in its stacking
153   //! layer
154   void restack(bool raise, OBClient *client);
155 };
156
157 }
158
159 #endif// __screen_hh