]> Dogcows Code - chaz/openbox/blob - src/screen.hh
better focusing. support for the take_focus protocol
[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 //! An offscreen window which shows that a NETWM compliant window manager is
93 //! running
94 Window _supportwindow;
95
96 //! A list of all managed clients on the screen, in their stacking order
97 ClientList _stacking;
98
99 //! Calculate the OBScreen::_area member
100 void calcArea();
101 //! Set the list of supported NETWM atoms on the root window
102 void setSupportedAtoms();
103 //! Set the client list on the root window
104 /*!
105 Sets the _NET_CLIENT_LIST root window property.<br>
106 Also calls OBScreen::updateStackingList.
107 */
108 void setClientList();
109 //! Set the client stacking list on the root window
110 /*!
111 Set the _NET_CLIENT_LIST_STACKING root window property.
112 */
113 void setStackingList();
114 //! Set the work area hint on the root window
115 /*!
116 Set the _NET_WORKAREA root window property.
117 */
118 void setWorkArea();
119
120 public:
121 #ifndef SWIG
122 //! Constructs a new OBScreen object
123 OBScreen(int screen);
124 //! Destroys the OBScreen object
125 virtual ~OBScreen();
126 #endif
127
128 inline int number() const { return _number; }
129
130 //! Returns if the screen was successfully managed
131 /*!
132 If this is false, then the screen should be deleted and should NOT be
133 used.
134 */
135 inline bool managed() const { return _managed; }
136 //! Returns the Image Control used for rendering on the screen
137 inline otk::BImageControl *imageControl() { return _image_control; }
138 //! Returns the area of the screen not reserved by applications' Struts
139 inline const otk::Rect &area() const { return _area; }
140 //! Returns the style in use on the screen
141 inline const otk::Style *style() const { return &_style; }
142 //! An offscreen window which gets focus when nothing else has it
143 inline Window focuswindow() const { return _focuswindow; }
144
145 //! Adds a window's strut to the screen's list of reserved spaces
146 void addStrut(otk::Strut *strut);
147 //! Removes a window's strut from the screen's list of reserved spaces
148 void removeStrut(otk::Strut *strut);
149
150 //! Manage any pre-existing windows on the screen
151 void manageExisting();
152 //! Manage a client window
153 /*!
154 This gives the window a frame, reparents it, selects events on it, etc.
155 */
156 void manageWindow(Window window);
157 //! Unmanage a client
158 /*!
159 This removes the window's frame, reparents it to root, unselects events on
160 it, etc.
161 */
162 void unmanageWindow(OBClient *client);
163
164 //! Raises/Lowers a client window above/below all others in its stacking
165 //! layer
166 void restack(bool raise, OBClient *client);
167 };
168
169 }
170
171 #endif// __screen_hh
This page took 0.044363 seconds and 5 git commands to generate.