aboutsummaryrefslogtreecommitdiff
path: root/src/Gnome.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gnome.cc')
-rw-r--r--src/Gnome.cc99
1 files changed, 34 insertions, 65 deletions
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 3b37e56..19505a3 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -28,6 +28,7 @@
28#include "WinClient.hh" 28#include "WinClient.hh"
29#include "Workspace.hh" 29#include "Workspace.hh"
30#include "Layer.hh" 30#include "Layer.hh"
31#include "Debug.hh"
31 32
32#include <iostream> 33#include <iostream>
33#ifdef HAVE_CSTRING 34#ifdef HAVE_CSTRING
@@ -39,11 +40,8 @@
39using std::cerr; 40using std::cerr;
40using std::endl; 41using std::endl;
41using std::list; 42using std::list;
42
43#ifdef DEBUG
44using std::hex; 43using std::hex;
45using std::dec; 44using std::dec;
46#endif // DEBUG
47 45
48Gnome::Gnome() { 46Gnome::Gnome() {
49 createAtoms(); 47 createAtoms();
@@ -142,14 +140,10 @@ void Gnome::setupFrame(FluxboxWindow &win) {
142 140
143bool Gnome::propertyNotify(WinClient &winclient, Atom the_property) { 141bool Gnome::propertyNotify(WinClient &winclient, Atom the_property) {
144 if (the_property == m_gnome_wm_win_state) { 142 if (the_property == m_gnome_wm_win_state) {
145#ifdef DEBUG 143 fbdbg<<"("<<__FUNCTION__<<"): _WIN_STATE"<<endl;
146 cerr<<__FILE__<<"("<<__FUNCTION__<<"): _WIN_STATE"<<endl;
147#endif // DEBUG
148 return true; 144 return true;
149 } else if (the_property == m_gnome_wm_win_layer) { 145 } else if (the_property == m_gnome_wm_win_layer) {
150#ifdef DEBUG 146 fbdbg<<"("<<__FUNCTION__<<"): _WIN_LAYER"<<endl;
151 cerr<<__FILE__<<"("<<__FUNCTION__<<"): _WIN_LAYER"<<endl;
152#endif // DEBUG
153 return true; 147 return true;
154 } 148 }
155 return false; 149 return false;
@@ -268,10 +262,8 @@ void Gnome::updateWorkspace(FluxboxWindow &win) {
268 if (win.isStuck()) { 262 if (win.isStuck()) {
269 val = -1; 263 val = -1;
270 } 264 }
271#ifdef DEBUG 265
272 cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<<val<< 266 fbdbg<<"setting workspace("<<val<<") for window("<<&win<<")"<<endl;
273 ") for window("<<&win<<")"<<endl;
274#endif // DEBUG
275 267
276 FluxboxWindow::ClientList::iterator client_it = win.clientList().begin(); 268 FluxboxWindow::ClientList::iterator client_it = win.clientList().begin();
277 FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end(); 269 FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end();
@@ -321,9 +313,9 @@ void Gnome::updateHints(FluxboxWindow &win) {
321 313
322bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) { 314bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) {
323 if (ce.message_type == m_gnome_wm_win_workspace) { 315 if (ce.message_type == m_gnome_wm_win_workspace) {
324#ifdef DEBUG 316
325 cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom="<<ce.data.l[0]<<endl; 317 fbdbg<<"Got workspace atom="<<ce.data.l[0]<<endl;
326#endif//!DEBUG 318
327 if ( winclient !=0 && // the message sent to client window? 319 if ( winclient !=0 && // the message sent to client window?
328 ce.data.l[0] >= 0 && 320 ce.data.l[0] >= 0 &&
329 ce.data.l[0] < (signed)winclient->screen().numberOfWorkspaces()) { 321 ce.data.l[0] < (signed)winclient->screen().numberOfWorkspaces()) {
@@ -339,12 +331,12 @@ bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen,
339 331
340 332
341 if (ce.message_type == m_gnome_wm_win_state) { 333 if (ce.message_type == m_gnome_wm_win_state) {
342#ifdef DEBUG 334
343 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_STATE"<<endl; 335 fbdbg<<"_WIN_STATE"<<endl;
344 cerr<<__FILE__<<"("<<__LINE__<<"): Mask of members to change:"<< 336 fbdbg<<"Mask of members to change:"<<
345 hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change 337 hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change
346 cerr<<"New members:"<<ce.data.l[1]<<endl; 338 fbdbg<<"New members:"<<ce.data.l[1]<<endl;
347#endif // DEBUG 339
348 340
349 if (winclient && winclient->fbwindow()) { 341 if (winclient && winclient->fbwindow()) {
350 //get new states 342 //get new states
@@ -357,15 +349,9 @@ bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen,
357 enableUpdate(); 349 enableUpdate();
358 } 350 }
359 } else if (ce.message_type == m_gnome_wm_win_hints) { 351 } else if (ce.message_type == m_gnome_wm_win_hints) {
360#ifdef DEBUG 352 fbdbg<<"_WIN_HINTS"<<endl;
361 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
362#endif // DEBUG
363
364 } else if (ce.message_type == m_gnome_wm_win_layer) { 353 } else if (ce.message_type == m_gnome_wm_win_layer) {
365#ifdef DEBUG 354 fbdbg<<"_WIN_LAYER"<<endl;
366 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_LAYER"<<endl;
367#endif // DEBUG
368
369 if (winclient && winclient->fbwindow()) 355 if (winclient && winclient->fbwindow())
370 setLayer(winclient->fbwindow(), ce.data.l[0]); 356 setLayer(winclient->fbwindow(), ce.data.l[0]);
371 } else 357 } else
@@ -375,32 +361,29 @@ bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen,
375} 361}
376 362
377void Gnome::setState(FluxboxWindow *win, int state) { 363void Gnome::setState(FluxboxWindow *win, int state) {
378#ifdef DEBUG 364 fbdbg<<"Gnome: state=0x"<<hex<<state<<dec<<endl;
379 cerr<<"Gnome: state=0x"<<hex<<state<<dec<<endl;
380#endif // DEBUG
381 365
382 if (state & WIN_STATE_STICKY) { 366 if (state & WIN_STATE_STICKY) {
383#ifdef DEBUG 367
384 cerr<<"Gnome state: Sticky"<<endl; 368 fbdbg<<"Gnome state: Sticky"<<endl;
385#endif // DEBUG 369
386 if (!win->isStuck()) 370 if (!win->isStuck())
387 win->stick(); 371 win->stick();
388 } else if (win->isStuck()) 372 } else if (win->isStuck())
389 win->stick(); 373 win->stick();
390 374
391 if (state & WIN_STATE_MINIMIZED) { 375 if (state & WIN_STATE_MINIMIZED) {
392#ifdef DEBUG 376 fbdbg<<"Gnome state: Minimized"<<endl;
393 cerr<<"Gnome state: Minimized"<<endl; 377
394#endif // DEBUG
395 if (win->isIconic()) 378 if (win->isIconic())
396 win->iconify(); 379 win->iconify();
397 } else if (win->isIconic()) 380 } else if (win->isIconic())
398 win->deiconify(true); 381 win->deiconify(true);
399 382
400 if (state & WIN_STATE_SHADED) { 383 if (state & WIN_STATE_SHADED) {
401#ifdef DEBUG 384
402 cerr<<"Gnome state: Shade"<<endl; 385 fbdbg<<"Gnome state: Shade"<<endl;
403#endif // DEBUG 386
404 if (!win->isShaded()) 387 if (!win->isShaded())
405 win->shade(); 388 win->shade();
406 } else if (win->isShaded()) 389 } else if (win->isShaded())
@@ -436,53 +419,39 @@ void Gnome::setLayer(FluxboxWindow *win, int layer) {
436 419
437 switch (layer) { 420 switch (layer) {
438 case WIN_LAYER_DESKTOP: 421 case WIN_LAYER_DESKTOP:
439#ifdef DEBUG 422 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DESKTOP)"<<endl;
440 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DESKTOP)"<<endl;
441#endif // DEBUG
442 layer = Layer::DESKTOP; 423 layer = Layer::DESKTOP;
443 break; 424 break;
444 case WIN_LAYER_BELOW: 425 case WIN_LAYER_BELOW:
445#ifdef DEBUG 426 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_BELOW)"<<endl;
446 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_BELOW)"<<endl;
447#endif // DEBUG
448 layer = Layer::BOTTOM; 427 layer = Layer::BOTTOM;
449 break; 428 break;
450 case WIN_LAYER_NORMAL: 429 case WIN_LAYER_NORMAL:
451#ifdef DEBUG 430 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_NORMAL)"<<endl;
452 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_NORMAL)"<<endl;
453#endif // DEBUG
454 layer = Layer::NORMAL; 431 layer = Layer::NORMAL;
455 break; 432 break;
456 case WIN_LAYER_ONTOP: 433 case WIN_LAYER_ONTOP:
457#ifdef DEBUG 434 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ONTOP)"<<endl;
458 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ONTOP)"<<endl;
459#endif // DEBUG
460 layer = Layer::TOP; 435 layer = Layer::TOP;
461 break; 436 break;
462 case WIN_LAYER_DOCK: 437 case WIN_LAYER_DOCK:
463#ifdef DEBUG 438 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DOCK)"<<endl;
464 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DOCK)"<<endl;
465#endif // DEBUG
466 layer = Layer::DOCK; 439 layer = Layer::DOCK;
467 break; 440 break;
468 case WIN_LAYER_ABOVE_DOCK: 441 case WIN_LAYER_ABOVE_DOCK:
469#ifdef DEBUG 442 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ABOVE_DOCK)"<<endl;
470 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ABOVE_DOCK)"<<endl;
471#endif // DEBUG
472 layer = Layer::ABOVE_DOCK; 443 layer = Layer::ABOVE_DOCK;
473 break; 444 break;
474 case WIN_LAYER_MENU: 445 case WIN_LAYER_MENU:
475#ifdef DEBUG 446 fbdbg<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_MENU)"<<endl;
476 cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_MENU)"<<endl;
477#endif // DEBUG
478 layer = Layer::MENU; 447 layer = Layer::MENU;
479 break; 448 break;
480 default: 449 default:
481 // our windows are in the opposite direction to gnome 450 // our windows are in the opposite direction to gnome
482 layer = Layer::DESKTOP - layer; 451 layer = Layer::DESKTOP - layer;
483#ifdef DEBUG 452
484 cerr<<"Gnome::setLayer("<<win->title()<<", "<<layer<<")"<<endl; 453 fbdbg<<"Gnome::setLayer("<<win->title()<<", "<<layer<<")"<<endl;
485#endif // DEBUG 454
486 break; 455 break;
487 } 456 }
488 457