aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-04 07:01:06 (GMT)
committerfluxgen <fluxgen>2002-02-04 07:01:06 (GMT)
commit60c51badc43ada00872ad8e138aa818d45f30d4d (patch)
treeafe00723f03bfeb846eeab83797568172a481660 /src
parent466e2980ccbec40de934197adf9a3af4097291f1 (diff)
downloadfluxbox-60c51badc43ada00872ad8e138aa818d45f30d4d.zip
fluxbox-60c51badc43ada00872ad8e138aa818d45f30d4d.tar.bz2
fixed event mask, netwm and gnome workspace and workspace_count atoms
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc125
1 files changed, 92 insertions, 33 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 5d20aff..951d5d8 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -53,36 +53,36 @@
53#include "Workspace.hh" 53#include "Workspace.hh"
54#include "Workspacemenu.hh" 54#include "Workspacemenu.hh"
55 55
56#ifdef STDC_HEADERS 56#ifdef STDC_HEADERS
57# include <sys/types.h> 57# include <sys/types.h>
58#endif // STDC_HEADERS 58#endif // STDC_HEADERS
59 59
60#ifdef HAVE_CTYPE_H 60#ifdef HAVE_CTYPE_H
61# include <ctype.h> 61# include <ctype.h>
62#endif // HAVE_CTYPE_H 62#endif // HAVE_CTYPE_H
63 63
64#ifdef HAVE_DIRENT_H 64#ifdef HAVE_DIRENT_H
65# include <dirent.h> 65# include <dirent.h>
66#endif // HAVE_DIRENT_H 66#endif // HAVE_DIRENT_H
67 67
68#ifdef HAVE_LOCALE_H 68#ifdef HAVE_LOCALE_H
69# include <locale.h> 69# include <locale.h>
70#endif // HAVE_LOCALE_H 70#endif // HAVE_LOCALE_H
71 71
72#ifdef HAVE_UNISTD_H 72#ifdef HAVE_UNISTD_H
73# include <sys/types.h> 73# include <sys/types.h>
74# include <unistd.h> 74# include <unistd.h>
75#endif // HAVE_UNISTD_H 75#endif // HAVE_UNISTD_H
76 76
77#ifdef HAVE_SYS_STAT_H 77#ifdef HAVE_SYS_STAT_H
78# include <sys/stat.h> 78# include <sys/stat.h>
79#endif // HAVE_SYS_STAT_H 79#endif // HAVE_SYS_STAT_H
80 80
81#ifdef HAVE_STDARG_H 81#ifdef HAVE_STDARG_H
82# include <stdarg.h> 82# include <stdarg.h>
83#endif // HAVE_STDARG_H 83#endif // HAVE_STDARG_H
84 84
85#ifndef MAXPATHLEN 85#ifndef MAXPATHLEN
86#define MAXPATHLEN 255 86#define MAXPATHLEN 255
87#endif // MAXPATHLEN 87#endif // MAXPATHLEN
88 88
@@ -230,7 +230,7 @@ resource(rm, screenname, altscreenname)
230 230
231 event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask | 231 event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
232 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | 232 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
233 ButtonPressMask | ButtonReleaseMask; 233 ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask;
234 234
235 XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning); 235 XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
236 XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask); 236 XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask);
@@ -294,6 +294,7 @@ resource(rm, screenname, altscreenname)
294 image_control, fluxbox->getStyleFilename(), getRootCommand().c_str()); 294 image_control, fluxbox->getStyleFilename(), getRootCommand().c_str());
295 295
296 #ifdef GNOME 296 #ifdef GNOME
297
297 /* create the GNOME window */ 298 /* create the GNOME window */
298 Window gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(), 299 Window gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(),
299 getRootWindow(), 0, 0, 5, 5, 0, 0, 0); 300 getRootWindow(), 0, 0, 5, 5, 0, 0, 0);
@@ -307,14 +308,30 @@ resource(rm, screenname, altscreenname)
307 getBaseDisplay()->getGnomeSupportingWMCheckAtom(), 308 getBaseDisplay()->getGnomeSupportingWMCheckAtom(),
308 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); 309 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1);
309 310
310 Atom gnomeatomlist[1] = {getBaseDisplay()->getGnomeWorkspaceAtom()}; 311 Atom gnomeatomlist[] = {
312 getBaseDisplay()->getGnomeWorkspaceAtom(),
313 getBaseDisplay()->getGnomeWorkspaceCountAtom(),
314 getBaseDisplay()->getGnomeStateAtom()
315 };
316
317 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
318 getBaseDisplay()->getGnomeProtAtom(), XA_ATOM, 32, PropModeReplace,
319 (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]);
311 320
312 XChangeProperty(getBaseDisplay()->getXDisplay(),
313 getRootWindow(), getBaseDisplay()->getGnomeProtAtom(),
314 XA_ATOM, 32, PropModeReplace,
315 (unsigned char *)gnomeatomlist, 1);
316 #endif 321 #endif
317 322
323 #ifdef NEWWMSPEC
324 Atom netwmsupported[] = {
325// getBaseDisplay()->getNETWMStateAtom(),
326 getBaseDisplay()->getNETNumberOfDesktopsAtom(),
327 getBaseDisplay()->getNETCurrentDesktopAtom(),
328 getBaseDisplay()->getNETSupportingWMCheckAtom(),
329 };
330
331 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
332 getBaseDisplay()->getNETSupportedAtom(), XA_ATOM, 32, PropModeReplace,
333 (unsigned char *)netwmsupported, (sizeof netwmsupported)/sizeof netwmsupported[0]);
334 #endif //!NEWWMSPEC
318 335
319 const char *s = i18n->getMessage( 336 const char *s = i18n->getMessage(
320 #ifdef NLS 337 #ifdef NLS
@@ -350,8 +367,8 @@ resource(rm, screenname, altscreenname)
350 367
351 geom_window = 368 geom_window =
352 XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(), 369 XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(),
353 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(), 370 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
354 InputOutput, getVisual(), mask, &attrib); 371 InputOutput, getVisual(), mask, &attrib);
355 geom_visible = False; 372 geom_visible = False;
356 373
357 if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) { 374 if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) {
@@ -362,7 +379,7 @@ resource(rm, screenname, altscreenname)
362 theme->getWindowStyle().t_focus.getColor()->getPixel()); 379 theme->getWindowStyle().t_focus.getColor()->getPixel());
363 } else { 380 } else {
364 geom_pixmap = image_control->renderImage(geom_w, geom_h, 381 geom_pixmap = image_control->renderImage(geom_w, geom_h,
365 &theme->getWindowStyle().t_focus); 382 &theme->getWindowStyle().t_focus);
366 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), 383 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
367 geom_window, geom_pixmap); 384 geom_window, geom_pixmap);
368 } 385 }
@@ -374,7 +391,7 @@ resource(rm, screenname, altscreenname)
374 theme->getWindowStyle().l_focus.getColor()->getPixel()); 391 theme->getWindowStyle().l_focus.getColor()->getPixel());
375 } else { 392 } else {
376 geom_pixmap = image_control->renderImage(geom_w, geom_h, 393 geom_pixmap = image_control->renderImage(geom_w, geom_h,
377 &theme->getWindowStyle().l_focus); 394 &theme->getWindowStyle().l_focus);
378 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), 395 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
379 geom_window, geom_pixmap); 396 geom_window, geom_pixmap);
380 } 397 }
@@ -398,13 +415,13 @@ resource(rm, screenname, altscreenname)
398 } 415 }
399 416
400 workspacemenu->insert(i18n-> 417 workspacemenu->insert(i18n->
401 getMessage( 418 getMessage(
402#ifdef NLS 419 #ifdef NLS
403 IconSet, IconIcons, 420 IconSet, IconIcons,
404#else // !NLS 421 #else // !NLS
405 0, 0, 422 0, 0,
406#endif // NLS 423 #endif // NLS
407 "Icons"), 424 "Icons"),
408 iconmenu); 425 iconmenu);
409 workspacemenu->update(); 426 workspacemenu->update();
410 427
@@ -413,9 +430,9 @@ resource(rm, screenname, altscreenname)
413 430
414 toolbar = new Toolbar(this); 431 toolbar = new Toolbar(this);
415 432
416#ifdef SLIT 433 #ifdef SLIT
417 slit = new Slit(this); 434 slit = new Slit(this);
418#endif // SLIT 435 #endif // SLIT
419 436
420 InitMenu(); 437 InitMenu();
421 438
@@ -423,7 +440,8 @@ resource(rm, screenname, altscreenname)
423 rootmenu->update(); 440 rootmenu->update();
424 441
425 changeWorkspaceID(0); 442 changeWorkspaceID(0);
426 443 updateNetizenWorkspaceCount();
444
427 int i; 445 int i;
428 unsigned int nchild; 446 unsigned int nchild;
429 Window r, p, *children; 447 Window r, p, *children;
@@ -432,21 +450,21 @@ resource(rm, screenname, altscreenname)
432 450
433 // preen the window list of all icon windows... for better dockapp support 451 // preen the window list of all icon windows... for better dockapp support
434 for (i = 0; i < (int) nchild; i++) { 452 for (i = 0; i < (int) nchild; i++) {
453
435 if (children[i] == None) continue; 454 if (children[i] == None) continue;
436 455
437 XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(), 456 XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(),
438 children[i]); 457 children[i]);
439 458
440 if (wmhints) { 459 if (wmhints) {
441 if ((wmhints->flags & IconWindowHint) && 460 if ((wmhints->flags & IconWindowHint) &&
442 (wmhints->icon_window != children[i])) 461 (wmhints->icon_window != children[i]))
443 for (int j = 0; j < (int) nchild; j++) 462 for (int j = 0; j < (int) nchild; j++) {
444 if (children[j] == wmhints->icon_window) { 463 if (children[j] == wmhints->icon_window) {
445 children[j] = None; 464 children[j] = None;
446
447 break; 465 break;
448 } 466 }
449 467 }
450 XFree(wmhints); 468 XFree(wmhints);
451 } 469 }
452 } 470 }
@@ -840,9 +858,29 @@ void BScreen::removeNetizen(Window w) {
840 858
841 859
842void BScreen::updateNetizenCurrentWorkspace(void) { 860void BScreen::updateNetizenCurrentWorkspace(void) {
861 #ifdef NEWWMSPEC
862 //update _NET_WM_CURRENT_DESKTOP
863 int workspace = getCurrentWorkspaceID();
864 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
865 getBaseDisplay()->getNETCurrentDesktopAtom(), XA_CARDINAL, 32, PropModeReplace,
866 (unsigned char *)&workspace, 1);
867 #endif
868 #ifdef GNOME
869 //update _WIN_WORKSPACE
870 int gnome_workspace = getCurrentWorkspaceID();
871 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
872 getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, PropModeReplace,
873 (unsigned char *)&gnome_workspace, 1);
874 #endif
875
843 LinkedListIterator<Netizen> it(netizenList); 876 LinkedListIterator<Netizen> it(netizenList);
844 for (; it.current(); it++) 877 for (; it.current(); it++)
845 it.current()->sendCurrentWorkspace(); 878 it.current()->sendCurrentWorkspace();
879
880
881 #ifdef DEBUG
882 cerr<<__FILE__<<"("<<__LINE__<<"): Update Current Workspace"<<endl;
883 #endif
846} 884}
847 885
848 886
@@ -850,6 +888,27 @@ void BScreen::updateNetizenWorkspaceCount(void) {
850 LinkedListIterator<Netizen> it(netizenList); 888 LinkedListIterator<Netizen> it(netizenList);
851 for (; it.current(); it++) 889 for (; it.current(); it++)
852 it.current()->sendWorkspaceCount(); 890 it.current()->sendWorkspaceCount();
891
892 #ifdef NEWWMSPEC
893 //update _NET_WM_NUMBER_OF_DESKTOPS
894 int numworkspaces = getCount()-1;
895 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
896 getBaseDisplay()->getNETNumberOfDesktopsAtom(), XA_CARDINAL, 32, PropModeReplace,
897 (unsigned char *)&numworkspaces, 1);
898 #endif
899
900 #ifdef GNOME
901 {
902 int numworkspaces = getCount();
903 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
904 getBaseDisplay()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, PropModeReplace,
905 (unsigned char *)&numworkspaces, 1);
906 }
907 #endif
908
909 #ifdef DEBUG
910 cerr<<__FILE__<<"("<<__LINE__<<"): Update Workspace Count"<<endl;
911 #endif
853} 912}
854 913
855 914