aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Ewmh.cc224
1 files changed, 112 insertions, 112 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index c19f06f..56d11fb 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -19,9 +19,9 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.cc,v 1.49 2004/08/26 01:51:21 akir Exp $ 22// $Id: Ewmh.cc,v 1.50 2004/09/10 15:36:04 akir Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
26#include "Screen.hh" 26#include "Screen.hh"
27#include "Window.hh" 27#include "Window.hh"
@@ -53,13 +53,13 @@ void Ewmh::initForScreen(BScreen &screen) {
53 53
54 54
55 Window wincheck = XCreateSimpleWindow(disp, 55 Window wincheck = XCreateSimpleWindow(disp,
56 screen.rootWindow().window(), 56 screen.rootWindow().window(),
57 0, 0, 5, 5, 0, 0, 0); 57 0, 0, 5, 5, 0, 0, 0);
58 58
59 if (wincheck != None) { 59 if (wincheck != None) {
60 // store the window so we can delete it later 60 // store the window so we can delete it later
61 m_windows.push_back(wincheck); 61 m_windows.push_back(wincheck);
62 62
63 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32, 63 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32,
64 PropModeReplace, (unsigned char *) &wincheck, 1); 64 PropModeReplace, (unsigned char *) &wincheck, 1);
65 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32, 65 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32,
@@ -68,7 +68,7 @@ void Ewmh::initForScreen(BScreen &screen) {
68 XChangeProperty(disp, wincheck, m_net_wm_name, XA_STRING, 8, 68 XChangeProperty(disp, wincheck, m_net_wm_name, XA_STRING, 8,
69 PropModeReplace, (unsigned char *) "Fluxbox", strlen("Fluxbox")); 69 PropModeReplace, (unsigned char *) "Fluxbox", strlen("Fluxbox"));
70 } 70 }
71 71
72 //set supported atoms 72 //set supported atoms
73 Atom atomsupported[] = { 73 Atom atomsupported[] = {
74 // window properties 74 // window properties
@@ -95,7 +95,7 @@ void Ewmh::initForScreen(BScreen &screen) {
95 m_net_current_desktop, 95 m_net_current_desktop,
96 m_net_active_window, 96 m_net_active_window,
97 m_net_close_window, 97 m_net_close_window,
98 m_net_moveresize_window, 98 m_net_moveresize_window,
99 m_net_workarea, 99 m_net_workarea,
100 100
101 // desktop properties 101 // desktop properties
@@ -103,28 +103,28 @@ void Ewmh::initForScreen(BScreen &screen) {
103 m_net_desktop_names, 103 m_net_desktop_names,
104 m_net_desktop_viewport, 104 m_net_desktop_viewport,
105 m_net_desktop_geometry, 105 m_net_desktop_geometry,
106 106
107 m_net_supporting_wm_check 107 m_net_supporting_wm_check
108 }; 108 };
109 /* From Extended Window Manager Hints, draft 1.3: 109 /* From Extended Window Manager Hints, draft 1.3:
110 * 110 *
111 * _NET_SUPPORTED, ATOM[]/32 111 * _NET_SUPPORTED, ATOM[]/32
112 * 112 *
113 * This property MUST be set by the Window Manager 113 * This property MUST be set by the Window Manager
114 * to indicate which hints it supports. For 114 * to indicate which hints it supports. For
115 * example: considering _NET_WM_STATE both this 115 * example: considering _NET_WM_STATE both this
116 * atom and all supported states 116 * atom and all supported states
117 * e.g. _NET_WM_STATE_MODAL, _NET_WM_STATE_STICKY, 117 * e.g. _NET_WM_STATE_MODAL, _NET_WM_STATE_STICKY,
118 * would be listed. This assumes that backwards 118 * would be listed. This assumes that backwards
119 * incompatible changes will not be made to the 119 * incompatible changes will not be made to the
120 * hints (without being renamed). 120 * hints (without being renamed).
121 */ 121 */
122 screen.rootWindow().changeProperty(m_net_supported, XA_ATOM, 32, 122 screen.rootWindow().changeProperty(m_net_supported, XA_ATOM, 32,
123 PropModeReplace, 123 PropModeReplace,
124 (unsigned char *) &atomsupported, 124 (unsigned char *) &atomsupported,
125 (sizeof atomsupported)/sizeof atomsupported[0]); 125 (sizeof atomsupported)/sizeof atomsupported[0]);
126 126
127 // update atoms 127 // update atoms
128 128
129 updateWorkspaceCount(screen); 129 updateWorkspaceCount(screen);
130 updateCurrentWorkspace(screen); 130 updateCurrentWorkspace(screen);
@@ -152,25 +152,25 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
152 * 152 *
153 * This SHOULD be set by the Client before mapping to a list of atoms 153 * This SHOULD be set by the Client before mapping to a list of atoms
154 * indicating the functional type of the window. This property SHOULD 154 * indicating the functional type of the window. This property SHOULD
155 * be used by the window manager in determining the decoration, 155 * be used by the window manager in determining the decoration,
156 * stacking position and other behavior of the window. The Client 156 * stacking position and other behavior of the window. The Client
157 * SHOULD specify window types in order of preference (the first being 157 * SHOULD specify window types in order of preference (the first being
158 * most preferable) but MUST include at least one of the basic window 158 * most preferable) but MUST include at least one of the basic window
159 * type atoms from the list below. This is to allow for extension of 159 * type atoms from the list below. This is to allow for extension of
160 * the list of types whilst providing default behavior for Window 160 * the list of types whilst providing default behavior for Window
161 * Managers that do not recognize the extensions. 161 * Managers that do not recognize the extensions.
162 * 162 *
163 */ 163 */
164 win.winClient().property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM, 164 win.winClient().property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM,
165 &ret_type, &fmt, &nitems, &bytes_after, 165 &ret_type, &fmt, &nitems, &bytes_after,
166 &data); 166 &data);
167 if (data) { 167 if (data) {
168 Atom *atoms = (unsigned long *)data; 168 Atom *atoms = (unsigned long *)data;
169 for (unsigned long l=0; l<nitems; ++l) { 169 for (unsigned long l=0; l<nitems; ++l) {
170 /* From Extended Window Manager Hints, draft 1.3: 170 /* From Extended Window Manager Hints, draft 1.3:
171 * 171 *
172 * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. 172 * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.
173 * Typically a Window Manager would keep such windows on top 173 * Typically a Window Manager would keep such windows on top
174 * of all other windows. 174 * of all other windows.
175 * 175 *
176 */ 176 */
@@ -203,8 +203,8 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
203 203
204 setupState(win); 204 setupState(win);
205 205
206 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL, 206 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
207 &ret_type, &fmt, &nitems, &bytes_after, 207 &ret_type, &fmt, &nitems, &bytes_after,
208 (unsigned char **) &data) && data) { 208 (unsigned char **) &data) && data) {
209 unsigned int desktop = static_cast<unsigned int>(*data); 209 unsigned int desktop = static_cast<unsigned int>(*data);
210 if (desktop == 0xFFFFFFFF && !win.isStuck()) 210 if (desktop == 0xFFFFFFFF && !win.isStuck())
@@ -229,9 +229,9 @@ void Ewmh::updateFocusedWindow(BScreen &screen, Window win) {
229 * 229 *
230 * _NET_ACTIVE_WINDOW, WINDOW/32 230 * _NET_ACTIVE_WINDOW, WINDOW/32
231 * 231 *
232 * The window ID of the currently active window or None 232 * The window ID of the currently active window or None
233 * if no window has the focus. This is a read-only 233 * if no window has the focus. This is a read-only
234 * property set by the Window Manager. 234 * property set by the Window Manager.
235 * 235 *
236 */ 236 */
237 screen.rootWindow().changeProperty(m_net_active_window, 237 screen.rootWindow().changeProperty(m_net_active_window,
@@ -243,14 +243,14 @@ void Ewmh::updateFocusedWindow(BScreen &screen, Window win) {
243void Ewmh::updateClientList(BScreen &screen) { 243void Ewmh::updateClientList(BScreen &screen) {
244 size_t num=0; 244 size_t num=0;
245 245
246 BScreen::Workspaces::const_iterator workspace_it = 246 BScreen::Workspaces::const_iterator workspace_it =
247 screen.getWorkspacesList().begin(); 247 screen.getWorkspacesList().begin();
248 const BScreen::Workspaces::const_iterator workspace_it_end = 248 const BScreen::Workspaces::const_iterator workspace_it_end =
249 screen.getWorkspacesList().end(); 249 screen.getWorkspacesList().end();
250 for (; workspace_it != workspace_it_end; ++workspace_it) { 250 for (; workspace_it != workspace_it_end; ++workspace_it) {
251 Workspace::Windows::iterator win_it = 251 Workspace::Windows::iterator win_it =
252 (*workspace_it)->windowList().begin(); 252 (*workspace_it)->windowList().begin();
253 Workspace::Windows::iterator win_it_end = 253 Workspace::Windows::iterator win_it_end =
254 (*workspace_it)->windowList().end(); 254 (*workspace_it)->windowList().end();
255 for (; win_it != win_it_end; ++win_it) { 255 for (; win_it != win_it_end; ++win_it) {
256 num += (*win_it)->numClients(); 256 num += (*win_it)->numClients();
@@ -259,7 +259,7 @@ void Ewmh::updateClientList(BScreen &screen) {
259 } 259 }
260 // and count icons 260 // and count icons
261 BScreen::Icons::const_iterator icon_it = screen.getIconList().begin(); 261 BScreen::Icons::const_iterator icon_it = screen.getIconList().begin();
262 BScreen::Icons::const_iterator icon_it_end = screen.getIconList().end(); 262 BScreen::Icons::const_iterator icon_it_end = screen.getIconList().end();
263 for (; icon_it != icon_it_end; ++icon_it) { 263 for (; icon_it != icon_it_end; ++icon_it) {
264 num += (*icon_it)->numClients(); 264 num += (*icon_it)->numClients();
265 } 265 }
@@ -275,20 +275,20 @@ void Ewmh::updateClientList(BScreen &screen) {
275 workspace_it = screen.getWorkspacesList().begin(); 275 workspace_it = screen.getWorkspacesList().begin();
276 int win=0; 276 int win=0;
277 for (; workspace_it != workspace_it_end; ++workspace_it) { 277 for (; workspace_it != workspace_it_end; ++workspace_it) {
278 278
279 // Fill in array of window ID's 279 // Fill in array of window ID's
280 Workspace::Windows::const_iterator it = 280 Workspace::Windows::const_iterator it =
281 (*workspace_it)->windowList().begin(); 281 (*workspace_it)->windowList().begin();
282 Workspace::Windows::const_iterator it_end = 282 Workspace::Windows::const_iterator it_end =
283 (*workspace_it)->windowList().end(); 283 (*workspace_it)->windowList().end();
284 for (; it != it_end; ++it) { 284 for (; it != it_end; ++it) {
285 if ((*it)->numClients() == 1) { 285 if ((*it)->numClients() == 1) {
286 wl[win++] = (*it)->clientWindow(); 286 wl[win++] = (*it)->clientWindow();
287 } else { 287 } else {
288 // add every client in fluxboxwindow to list window list 288 // add every client in fluxboxwindow to list window list
289 std::list<WinClient *>::iterator client_it = 289 std::list<WinClient *>::iterator client_it =
290 (*it)->clientList().begin(); 290 (*it)->clientList().begin();
291 std::list<WinClient *>::iterator client_it_end = 291 std::list<WinClient *>::iterator client_it_end =
292 (*it)->clientList().end(); 292 (*it)->clientList().end();
293 for (; client_it != client_it_end; ++client_it) 293 for (; client_it != client_it_end; ++client_it)
294 wl[win++] = (*client_it)->window(); 294 wl[win++] = (*client_it)->window();
@@ -313,12 +313,12 @@ void Ewmh::updateClientList(BScreen &screen) {
313 * _NET_CLIENT_LIST_STACKING, WINDOW[]/32 313 * _NET_CLIENT_LIST_STACKING, WINDOW[]/32
314 * 314 *
315 * These arrays contain all X Windows managed by 315 * These arrays contain all X Windows managed by
316 * the Window Manager. _NET_CLIENT_LIST has 316 * the Window Manager. _NET_CLIENT_LIST has
317 * initial mapping order, starting with the oldest 317 * initial mapping order, starting with the oldest
318 * window. _NET_CLIENT_LIST_STACKING has 318 * window. _NET_CLIENT_LIST_STACKING has
319 * bottom-to-top stacking order. These properties 319 * bottom-to-top stacking order. These properties
320 * SHOULD be set and updated by the Window 320 * SHOULD be set and updated by the Window
321 * Manager. 321 * Manager.
322 */ 322 */
323 screen.rootWindow().changeProperty(m_net_client_list, 323 screen.rootWindow().changeProperty(m_net_client_list,
324 XA_WINDOW, 32, 324 XA_WINDOW, 32,
@@ -326,7 +326,7 @@ void Ewmh::updateClientList(BScreen &screen) {
326 screen.rootWindow().changeProperty(m_net_client_list_stacking, 326 screen.rootWindow().changeProperty(m_net_client_list_stacking,
327 XA_WINDOW, 32, 327 XA_WINDOW, 32,
328 PropModeReplace, (unsigned char *)wl, num); 328 PropModeReplace, (unsigned char *)wl, num);
329 329
330 delete [] wl; 330 delete [] wl;
331} 331}
332 332
@@ -335,15 +335,15 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
335 * 335 *
336 * _NET_DESKTOP_NAMES, UTF8_STRING[] 336 * _NET_DESKTOP_NAMES, UTF8_STRING[]
337 * 337 *
338 * The names of all virtual desktops. 338 * The names of all virtual desktops.
339 * This is a list of NULL-terminated strings in UTF-8 339 * This is a list of NULL-terminated strings in UTF-8
340 * encoding [UTF8]. This property MAY be changed by a 340 * encoding [UTF8]. This property MAY be changed by a
341 * Pager or the Window Manager at any time. 341 * Pager or the Window Manager at any time.
342 * 342 *
343 * Note: The number of names could be different from 343 * Note: The number of names could be different from
344 * _NET_NUMBER_OF_DESKTOPS. If it is less than 344 * _NET_NUMBER_OF_DESKTOPS. If it is less than
345 * _NET_NUMBER_OF_DESKTOPS, then the desktops with high 345 * _NET_NUMBER_OF_DESKTOPS, then the desktops with high
346 * numbers are unnamed. If it is larger than 346 * numbers are unnamed. If it is larger than
347 * _NET_NUMBER_OF_DESKTOPS, then the excess names outside 347 * _NET_NUMBER_OF_DESKTOPS, then the excess names outside
348 * of the _NET_NUMBER_OF_DESKTOPS are considered to be 348 * of the _NET_NUMBER_OF_DESKTOPS are considered to be
349 * reserved in case the number of desktops is increased. 349 * reserved in case the number of desktops is increased.
@@ -351,19 +351,19 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
351 * Rationale: The name is not a necessary attribute of a 351 * Rationale: The name is not a necessary attribute of a
352 * virtual desktop. Thus the availability or unavailability 352 * virtual desktop. Thus the availability or unavailability
353 * of names has no impact on virtual desktop functionality. 353 * of names has no impact on virtual desktop functionality.
354 * Since names are set by users and users are likely to 354 * Since names are set by users and users are likely to
355 * preset names for a fixed number of desktops, it 355 * preset names for a fixed number of desktops, it
356 * doesn't make sense to shrink or grow this list when the 356 * doesn't make sense to shrink or grow this list when the
357 * number of available desktops changes. 357 * number of available desktops changes.
358 * 358 *
359 */ 359 */
360 XTextProperty text; 360 XTextProperty text;
361 const BScreen::WorkspaceNames &workspacenames = screen.getWorkspaceNames(); 361 const BScreen::WorkspaceNames &workspacenames = screen.getWorkspaceNames();
362 const size_t number_of_desks = workspacenames.size(); 362 const size_t number_of_desks = workspacenames.size();
363 363
364 char *names[number_of_desks]; 364 char *names[number_of_desks];
365 365
366 for (size_t i = 0; i < number_of_desks; i++) { 366 for (size_t i = 0; i < number_of_desks; i++) {
367 names[i] = new char[workspacenames[i].size() + 1]; // +1 for \0 367 names[i] = new char[workspacenames[i].size() + 1]; // +1 for \0
368 memset(names[i], 0, workspacenames[i].size()); 368 memset(names[i], 0, workspacenames[i].size());
369 strcpy(names[i], workspacenames[i].c_str()); 369 strcpy(names[i], workspacenames[i].c_str());
@@ -376,7 +376,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
376 } 376 }
377 377
378 for (size_t i = 0; i < number_of_desks; i++) 378 for (size_t i = 0; i < number_of_desks; i++)
379 delete [] names[i]; 379 delete [] names[i];
380} 380}
381 381
382void Ewmh::updateCurrentWorkspace(BScreen &screen) { 382void Ewmh::updateCurrentWorkspace(BScreen &screen) {
@@ -386,11 +386,11 @@ void Ewmh::updateCurrentWorkspace(BScreen &screen) {
386 * 386 *
387 * The index of the current desktop. This is always 387 * The index of the current desktop. This is always
388 * an integer between 0 and _NET_NUMBER_OF_DESKTOPS - 1. 388 * an integer between 0 and _NET_NUMBER_OF_DESKTOPS - 1.
389 * This MUST be set and updated by the Window Manager. 389 * This MUST be set and updated by the Window Manager.
390 * 390 *
391 */ 391 */
392 unsigned int workspace = screen.currentWorkspaceID(); 392 unsigned int workspace = screen.currentWorkspaceID();
393 screen.rootWindow().changeProperty(m_net_current_desktop, 393 screen.rootWindow().changeProperty(m_net_current_desktop,
394 XA_CARDINAL, 32, 394 XA_CARDINAL, 32,
395 PropModeReplace, 395 PropModeReplace,
396 (unsigned char *)&workspace, 1); 396 (unsigned char *)&workspace, 1);
@@ -407,21 +407,21 @@ void Ewmh::updateWorkspaceCount(BScreen &screen) {
407 * desktops. 407 * desktops.
408 */ 408 */
409 unsigned int numworkspaces = screen.getCount(); 409 unsigned int numworkspaces = screen.getCount();
410 screen.rootWindow().changeProperty(m_net_number_of_desktops, 410 screen.rootWindow().changeProperty(m_net_number_of_desktops,
411 XA_CARDINAL, 32, 411 XA_CARDINAL, 32,
412 PropModeReplace, 412 PropModeReplace,
413 (unsigned char *)&numworkspaces, 1); 413 (unsigned char *)&numworkspaces, 1);
414} 414}
415 415
416void Ewmh::updateViewPort(BScreen &screen) { 416void Ewmh::updateViewPort(BScreen &screen) {
417 /* From Extended Window Manager Hints, draft 1.3: 417 /* From Extended Window Manager Hints, draft 1.3:
418 * 418 *
419 * _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32 419 * _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
420 * 420 *
421 * Array of pairs of cardinals that define the 421 * Array of pairs of cardinals that define the
422 * top left corner of each desktop's viewport. 422 * top left corner of each desktop's viewport.
423 * For Window Managers that don't support large 423 * For Window Managers that don't support large
424 * desktops, this MUST always be set to (0,0). 424 * desktops, this MUST always be set to (0,0).
425 * 425 *
426 */ 426 */
427 int value[2] = {0, 0}; // we dont support large desktops 427 int value[2] = {0, 0}; // we dont support large desktops
@@ -437,11 +437,11 @@ void Ewmh::updateGeometry(BScreen &screen) {
437 * _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32 437 * _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32
438 * 438 *
439 * Array of two cardinals that defines the common size 439 * Array of two cardinals that defines the common size
440 * of all desktops (this is equal to the screen size 440 * of all desktops (this is equal to the screen size
441 * if the Window Manager doesn't support large 441 * if the Window Manager doesn't support large
442 * desktops, otherwise it's equal to the virtual size 442 * desktops, otherwise it's equal to the virtual size
443 * of the desktop). This property SHOULD be set by the 443 * of the desktop). This property SHOULD be set by the
444 * Window Manager. 444 * Window Manager.
445 * 445 *
446 */ 446 */
447 int value[2] = {screen.width(), screen.height()}; 447 int value[2] = {screen.width(), screen.height()};
@@ -454,23 +454,23 @@ void Ewmh::updateGeometry(BScreen &screen) {
454 454
455void Ewmh::updateWorkarea(BScreen &screen) { 455void Ewmh::updateWorkarea(BScreen &screen) {
456 /* From Extended Window Manager Hints, draft 1.3: 456 /* From Extended Window Manager Hints, draft 1.3:
457 * 457 *
458 * _NET_WORKAREA, x, y, width, height CARDINAL[][4]/32 458 * _NET_WORKAREA, x, y, width, height CARDINAL[][4]/32
459 * 459 *
460 * This property MUST be set by the Window Manager upon 460 * This property MUST be set by the Window Manager upon
461 * calculating the work area for each desktop. Contains a 461 * calculating the work area for each desktop. Contains a
462 * geometry for each desktop. These geometries are 462 * geometry for each desktop. These geometries are
463 * specified relative to the viewport on each desktop and 463 * specified relative to the viewport on each desktop and
464 * specify an area that is completely contained within the 464 * specify an area that is completely contained within the
465 * viewport. Work area SHOULD be used by desktop applications 465 * viewport. Work area SHOULD be used by desktop applications
466 * to place desktop icons appropriately. 466 * to place desktop icons appropriately.
467 * 467 *
468 */ 468 */
469 469
470 /* !!TODO 470 /* !!TODO
471 * Not sure how to handle xinerama stuff here. 471 * Not sure how to handle xinerama stuff here.
472 * So i'm just doing this on the first head. 472 * So i'm just doing this on the first head.
473 */ 473 */
474 unsigned int *coords = new unsigned int[4*screen.getCount()]; 474 unsigned int *coords = new unsigned int[4*screen.getCount()];
475 for (unsigned int i=0; i<screen.getCount()*4; i+=4) { 475 for (unsigned int i=0; i<screen.getCount()*4; i+=4) {
476 // x, y 476 // x, y
@@ -499,7 +499,7 @@ void Ewmh::updateLayer(FluxboxWindow &win) {
499 /* 499 /*
500 if (win.getLayer() == Fluxbox::instance()->getAboveDockLayer()) { 500 if (win.getLayer() == Fluxbox::instance()->getAboveDockLayer()) {
501 // _NET_WM_STATE_BELOW 501 // _NET_WM_STATE_BELOW
502 502
503 } else if (win.getLayer() == Fluxbox::instance()->getBottomLayer()) { 503 } else if (win.getLayer() == Fluxbox::instance()->getBottomLayer()) {
504 // _NET_WM_STATE_ABOVE 504 // _NET_WM_STATE_ABOVE
505 } 505 }
@@ -525,7 +525,7 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
525 525
526 526
527// return true if we did handle the atom here 527// return true if we did handle the atom here
528bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, 528bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
529 BScreen * screen, WinClient * const winclient) { 529 BScreen * screen, WinClient * const winclient) {
530 if (ce.message_type == m_net_wm_desktop) { 530 if (ce.message_type == m_net_wm_desktop) {
531 // ce.data.l[0] = workspace number 531 // ce.data.l[0] = workspace number
@@ -550,7 +550,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
550 screen = &fbwin->screen(); 550 screen = &fbwin->screen();
551 // valid workspace number? 551 // valid workspace number?
552 if (static_cast<unsigned int>(ce.data.l[0]) < screen->getCount()) 552 if (static_cast<unsigned int>(ce.data.l[0]) < screen->getCount())
553 screen->sendToWorkspace(ce.data.l[0], fbwin, false); 553 screen->sendToWorkspace(ce.data.l[0], fbwin, false);
554 554
555 return true; 555 return true;
556 } else if (ce.message_type == m_net_wm_state) { 556 } else if (ce.message_type == m_net_wm_state) {
@@ -577,10 +577,10 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
577 if (screen == 0) 577 if (screen == 0)
578 return true; 578 return true;
579 // ce.data.l[0] = number of workspaces 579 // ce.data.l[0] = number of workspaces
580 580
581 // no need to alter number of desktops if they are the same 581 // no need to alter number of desktops if they are the same
582 // or if requested number of workspace is less than zero 582 // or if requested number of workspace is less than zero
583 if (screen->getCount() == static_cast<unsigned int>(ce.data.l[0]) || 583 if (screen->getCount() == static_cast<unsigned int>(ce.data.l[0]) ||
584 ce.data.l[0] < 0) 584 ce.data.l[0] < 0)
585 return true; 585 return true;
586 586
@@ -594,28 +594,28 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
594 } 594 }
595 } else { // add workspaces to screen until workspace count match the requested size 595 } else { // add workspaces to screen until workspace count match the requested size
596 while (screen->getCount() != static_cast<unsigned int>(ce.data.l[0])) { 596 while (screen->getCount() != static_cast<unsigned int>(ce.data.l[0])) {
597 screen->addWorkspace(); 597 screen->addWorkspace();
598 } 598 }
599 } 599 }
600 600
601 return true; 601 return true;
602 } else if (ce.message_type == m_net_current_desktop) { 602 } else if (ce.message_type == m_net_current_desktop) {
603 if (screen == 0) 603 if (screen == 0)
604 return true; 604 return true;
605 // ce.data.l[0] = workspace number 605 // ce.data.l[0] = workspace number
606 606
607 // prevent out of range value 607 // prevent out of range value
608 if (static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount()) 608 if (static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount())
609 return true; 609 return true;
610 screen->changeWorkspaceID(ce.data.l[0]); 610 screen->changeWorkspaceID(ce.data.l[0]);
611 return true; 611 return true;
612 } else if (ce.message_type == m_net_active_window) { 612 } else if (ce.message_type == m_net_active_window) {
613 613
614 // make sure we have a valid window 614 // make sure we have a valid window
615 if (winclient == 0) 615 if (winclient == 0)
616 return true; 616 return true;
617 // ce.window = window to focus 617 // ce.window = window to focus
618 618
619 winclient->focus(); 619 winclient->focus();
620 if (winclient->fbwindow()) 620 if (winclient->fbwindow())
621 winclient->fbwindow()->raise(); 621 winclient->fbwindow()->raise();
@@ -677,7 +677,7 @@ void Ewmh::createAtoms() {
677 677
678 m_net_close_window = XInternAtom(disp, "_NET_CLOSE_WINDOW", False); 678 m_net_close_window = XInternAtom(disp, "_NET_CLOSE_WINDOW", False);
679 m_net_moveresize_window = XInternAtom(disp, "_NET_MOVERESIZE_WINDOW", False); 679 m_net_moveresize_window = XInternAtom(disp, "_NET_MOVERESIZE_WINDOW", False);
680 680
681 // TODO: implement this one 681 // TODO: implement this one
682 m_net_wm_moveresize = XInternAtom(disp, "_NET_WM_MOVERESIZE", False); 682 m_net_wm_moveresize = XInternAtom(disp, "_NET_WM_MOVERESIZE", False);
683 683
@@ -714,7 +714,7 @@ void Ewmh::createAtoms() {
714 714
715 715
716void Ewmh::setFullscreen(FluxboxWindow &win, bool value) { 716void Ewmh::setFullscreen(FluxboxWindow &win, bool value) {
717 // fullscreen implies maximised, above dock layer, 717 // fullscreen implies maximised, above dock layer,
718 // and no decorations (or decorations offscreen) 718 // and no decorations (or decorations offscreen)
719 WindowState *saved_state = getState(win); 719 WindowState *saved_state = getState(win);
720 if (value) { 720 if (value) {
@@ -762,15 +762,15 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
762 } else if (state == m_net_wm_state_maximized_horz ) { // maximized Horizontal 762 } else if (state == m_net_wm_state_maximized_horz ) { // maximized Horizontal
763 if ((value && !win.isMaximized()) || 763 if ((value && !win.isMaximized()) ||
764 (!value && win.isMaximized())) 764 (!value && win.isMaximized()))
765 win.maximizeHorizontal(); 765 win.maximizeHorizontal();
766 } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical 766 } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical
767 if ((value && !win.isMaximized()) || 767 if ((value && !win.isMaximized()) ||
768 (!value && win.isMaximized())) 768 (!value && win.isMaximized()))
769 win.maximizeVertical(); 769 win.maximizeVertical();
770 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 770 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
771 setFullscreen(win, value); 771 setFullscreen(win, value);
772 } else if (state == m_net_wm_state_hidden || 772 } else if (state == m_net_wm_state_hidden ||
773 state == m_net_wm_state_skip_taskbar) { 773 state == m_net_wm_state_skip_taskbar) {
774 win.setFocusHidden(value); 774 win.setFocusHidden(value);
775 win.setIconHidden(win.isFocusHidden()); 775 win.setIconHidden(win.isFocusHidden());
776 } else if (state == m_net_wm_state_below) { // bottom layer 776 } else if (state == m_net_wm_state_below) { // bottom layer
@@ -829,7 +829,7 @@ void Ewmh::updateStrut(WinClient &winclient) {
829 &ret_type, &fmt, &nitems, &bytes_after, 829 &ret_type, &fmt, &nitems, &bytes_after,
830 (unsigned char **) &data) && data) { 830 (unsigned char **) &data) && data) {
831 831
832 winclient.setStrut(winclient.screen().requestStrut(data[0], data[1], 832 winclient.setStrut(winclient.screen().requestStrut(data[0], data[1],
833 data[2], data[3])); 833 data[2], data[3]));
834 winclient.screen().updateAvailableWorkspaceArea(); 834 winclient.screen().updateAvailableWorkspaceArea();
835 } 835 }
@@ -840,18 +840,18 @@ void Ewmh::setupState(FluxboxWindow &win) {
840 * 840 *
841 * _NET_WM_STATE, ATOM[] 841 * _NET_WM_STATE, ATOM[]
842 * 842 *
843 * A list of hints describing the window state. Atoms present in 843 * A list of hints describing the window state. Atoms present in
844 * the list MUST be considered set, atoms not present in the list 844 * the list MUST be considered set, atoms not present in the list
845 * MUST be considered not set. The Window Manager SHOULD honor 845 * MUST be considered not set. The Window Manager SHOULD honor
846 * _NET_WM_STATE whenever a withdrawn window requests to be mapped. 846 * _NET_WM_STATE whenever a withdrawn window requests to be mapped.
847 * A Client wishing to change the state of a window MUST send a 847 * A Client wishing to change the state of a window MUST send a
848 * _NET_WM_STATE client message to the root window (see below). 848 * _NET_WM_STATE client message to the root window (see below).
849 * The Window Manager MUST keep this property updated to reflect 849 * The Window Manager MUST keep this property updated to reflect
850 * the current state of the window. 850 * the current state of the window.
851 * 851 *
852 * The Window Manager should remove the property whenever a window 852 * The Window Manager should remove the property whenever a window
853 * is withdrawn, but it should leave the property in place when it 853 * is withdrawn, but it should leave the property in place when it
854 * is shutting down, e.g. in response to losing ownership of the 854 * is shutting down, e.g. in response to losing ownership of the
855 * WM_Sn manager selection. 855 * WM_Sn manager selection.
856 */ 856 */
857 Atom ret_type; 857 Atom ret_type;
@@ -859,10 +859,10 @@ void Ewmh::setupState(FluxboxWindow &win) {
859 unsigned long nitems, bytes_after; 859 unsigned long nitems, bytes_after;
860 unsigned char *data = 0; 860 unsigned char *data = 0;
861 861
862 win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM, 862 win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
863 &ret_type, &fmt, &nitems, &bytes_after, 863 &ret_type, &fmt, &nitems, &bytes_after,
864 &data); 864 &data);
865 if (data) { 865 if (data) {
866 Atom *states = (Atom *)data; 866 Atom *states = (Atom *)data;
867 for (unsigned long i=0; i < nitems; ++i) 867 for (unsigned long i=0; i < nitems; ++i)
868 setState(win, states[i], true); 868 setState(win, states[i], true);
@@ -871,8 +871,8 @@ void Ewmh::setupState(FluxboxWindow &win) {
871 } 871 }
872} 872}
873 873
874Ewmh::WindowState::WindowState(int t_x, int t_y, 874Ewmh::WindowState::WindowState(int t_x, int t_y,
875 unsigned int t_width, 875 unsigned int t_width,
876 unsigned int t_height, 876 unsigned int t_height,
877 int t_layer, unsigned int t_decor) : 877 int t_layer, unsigned int t_decor) :
878 x(t_x), y(t_y), 878 x(t_x), y(t_y),