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