]> Dogcows Code - chaz/openbox/blob - src/screen.hh
fa28676498fb7409a06aaec7fc5bb322ce6e4734
[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 enum StackLayer {
47 Layer_Icon, // 0 - iconified windows, in any order at all
48 Layer_Desktop, // 1 - desktop windows
49 Layer_Below, // 2 - normal windows w/ below
50 Layer_Normal, // 3 - normal windows
51 Layer_Above, // 4 - normal windows w/ above
52 Layer_Top, // 5 - always-on-top-windows (docks?)
53 Layer_Fullscreen, // 6 - fullscreeen windows
54 Layer_Internal, // 7 - openbox windows/menus
55 NUM_LAYERS
56 };
57
58 //! All managed clients on the screen (in order of being mapped)
59 ClientList clients;
60
61 private:
62 //! Was %Openbox able to manage the screen?
63 bool _managed;
64
65 //! The number of the screen on the X server
66 int _number;
67
68 //! Information about this screen
69 const otk::ScreenInfo *_info;
70
71 //! The Image Control used for rendering on the screen
72 otk::BImageControl *_image_control;
73
74 //! The style with which to render on the screen
75 otk::Style _style;
76
77 //! The screen's root window
78 OBRootWindow _root;
79
80 //! Is the root colormap currently installed?
81 bool _root_cmap_installed;
82
83 //! Area usable for placement etc (total - struts)
84 otk::Rect _area;
85
86 //! Areas of the screen reserved by applications
87 StrutList _struts;
88
89 //! An offscreen window which gets focus when nothing else has it
90 Window _focuswindow;
91
92 //! A list of all managed clients on the screen, in their stacking order
93 ClientList _stacking;
94
95 //! Calculate the OBScreen::_area member
96 void calcArea();
97 //! Set the client list on the root window
98 /*!
99 Sets the _NET_CLIENT_LIST root window property.<br>
100 Also calls OBScreen::updateStackingList.
101 */
102 void setClientList();
103 //! Set the client stacking list on the root window
104 /*!
105 Set the _NET_CLIENT_LIST_STACKING root window property.
106 */
107 void setStackingList();
108 //! Set the work area hint on the root window
109 /*!
110 Set the _NET_WORKAREA root window property.
111 */
112 void setWorkArea();
113
114 public:
115 #ifndef SWIG
116 //! Constructs a new OBScreen object
117 OBScreen(int screen);
118 //! Destroys the OBScreen object
119 virtual ~OBScreen();
120 #endif
121
122 inline int number() const { return _number; }
123
124 //! Returns if the screen was successfully managed
125 /*!
126 If this is false, then the screen should be deleted and should NOT be
127 used.
128 */
129 inline bool managed() const { return _managed; }
130 //! Returns the Image Control used for rendering on the screen
131 inline otk::BImageControl *imageControl() { return _image_control; }
132 //! Returns the area of the screen not reserved by applications' Struts
133 inline const otk::Rect &area() const { return _area; }
134 //! Returns the style in use on the screen
135 inline const otk::Style *style() const { return &_style; }
136 //! An offscreen window which gets focus when nothing else has it
137 inline Window focuswindow() const { return _focuswindow; }
138
139 //! Adds a window's strut to the screen's list of reserved spaces
140 void addStrut(otk::Strut *strut);
141 //! Removes a window's strut from the screen's list of reserved spaces
142 void removeStrut(otk::Strut *strut);
143
144 //! Manage any pre-existing windows on the screen
145 void manageExisting();
146 //! Manage a client window
147 /*!
148 This gives the window a frame, reparents it, selects events on it, etc.
149 */
150 void manageWindow(Window window);
151 //! Unmanage a client
152 /*!
153 This removes the window's frame, reparents it to root, unselects events on
154 it, etc.
155 */
156 void unmanageWindow(OBClient *client);
157
158 //! Raises/Lowers a client window above/below all others in its stacking
159 //! layer
160 void restack(bool raise, OBClient *client);
161 };
162
163 }
164
165 #endif// __screen_hh
This page took 0.040673 seconds and 4 git commands to generate.