fixed event mask, netwm and gnome workspace and workspace_count atoms
This commit is contained in:
parent
466e2980cc
commit
60c51badc4
1 changed files with 92 additions and 33 deletions
123
src/Screen.cc
123
src/Screen.cc
|
@ -53,36 +53,36 @@
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
#include "Workspacemenu.hh"
|
#include "Workspacemenu.hh"
|
||||||
|
|
||||||
#ifdef STDC_HEADERS
|
#ifdef STDC_HEADERS
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif // STDC_HEADERS
|
#endif // STDC_HEADERS
|
||||||
|
|
||||||
#ifdef HAVE_CTYPE_H
|
#ifdef HAVE_CTYPE_H
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
#endif // HAVE_CTYPE_H
|
#endif // HAVE_CTYPE_H
|
||||||
|
|
||||||
#ifdef HAVE_DIRENT_H
|
#ifdef HAVE_DIRENT_H
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif // HAVE_DIRENT_H
|
#endif // HAVE_DIRENT_H
|
||||||
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
# include <locale.h>
|
# include <locale.h>
|
||||||
#endif // HAVE_LOCALE_H
|
#endif // HAVE_LOCALE_H
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif // HAVE_UNISTD_H
|
#endif // HAVE_UNISTD_H
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
#ifdef HAVE_SYS_STAT_H
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif // HAVE_SYS_STAT_H
|
#endif // HAVE_SYS_STAT_H
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H
|
#ifdef HAVE_STDARG_H
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
#endif // HAVE_STDARG_H
|
#endif // HAVE_STDARG_H
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
#define MAXPATHLEN 255
|
#define MAXPATHLEN 255
|
||||||
#endif // MAXPATHLEN
|
#endif // MAXPATHLEN
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ resource(rm, screenname, altscreenname)
|
||||||
|
|
||||||
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
||||||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
||||||
ButtonPressMask | ButtonReleaseMask;
|
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask;
|
||||||
|
|
||||||
XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
|
XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
|
||||||
XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask);
|
XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask);
|
||||||
|
@ -294,6 +294,7 @@ resource(rm, screenname, altscreenname)
|
||||||
image_control, fluxbox->getStyleFilename(), getRootCommand().c_str());
|
image_control, fluxbox->getStyleFilename(), getRootCommand().c_str());
|
||||||
|
|
||||||
#ifdef GNOME
|
#ifdef GNOME
|
||||||
|
|
||||||
/* create the GNOME window */
|
/* create the GNOME window */
|
||||||
Window gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(),
|
Window gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(),
|
||||||
getRootWindow(), 0, 0, 5, 5, 0, 0, 0);
|
getRootWindow(), 0, 0, 5, 5, 0, 0, 0);
|
||||||
|
@ -307,14 +308,30 @@ resource(rm, screenname, altscreenname)
|
||||||
getBaseDisplay()->getGnomeSupportingWMCheckAtom(),
|
getBaseDisplay()->getGnomeSupportingWMCheckAtom(),
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1);
|
||||||
|
|
||||||
Atom gnomeatomlist[1] = {getBaseDisplay()->getGnomeWorkspaceAtom()};
|
Atom gnomeatomlist[] = {
|
||||||
|
getBaseDisplay()->getGnomeWorkspaceAtom(),
|
||||||
|
getBaseDisplay()->getGnomeWorkspaceCountAtom(),
|
||||||
|
getBaseDisplay()->getGnomeStateAtom()
|
||||||
|
};
|
||||||
|
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getGnomeProtAtom(), XA_ATOM, 32, PropModeReplace,
|
||||||
|
(unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]);
|
||||||
|
|
||||||
XChangeProperty(getBaseDisplay()->getXDisplay(),
|
|
||||||
getRootWindow(), getBaseDisplay()->getGnomeProtAtom(),
|
|
||||||
XA_ATOM, 32, PropModeReplace,
|
|
||||||
(unsigned char *)gnomeatomlist, 1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEWWMSPEC
|
||||||
|
Atom netwmsupported[] = {
|
||||||
|
// getBaseDisplay()->getNETWMStateAtom(),
|
||||||
|
getBaseDisplay()->getNETNumberOfDesktopsAtom(),
|
||||||
|
getBaseDisplay()->getNETCurrentDesktopAtom(),
|
||||||
|
getBaseDisplay()->getNETSupportingWMCheckAtom(),
|
||||||
|
};
|
||||||
|
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getNETSupportedAtom(), XA_ATOM, 32, PropModeReplace,
|
||||||
|
(unsigned char *)netwmsupported, (sizeof netwmsupported)/sizeof netwmsupported[0]);
|
||||||
|
#endif //!NEWWMSPEC
|
||||||
|
|
||||||
const char *s = i18n->getMessage(
|
const char *s = i18n->getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
|
@ -350,8 +367,8 @@ resource(rm, screenname, altscreenname)
|
||||||
|
|
||||||
geom_window =
|
geom_window =
|
||||||
XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
|
0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
|
||||||
InputOutput, getVisual(), mask, &attrib);
|
InputOutput, getVisual(), mask, &attrib);
|
||||||
geom_visible = False;
|
geom_visible = False;
|
||||||
|
|
||||||
if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) {
|
if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) {
|
||||||
|
@ -362,7 +379,7 @@ resource(rm, screenname, altscreenname)
|
||||||
theme->getWindowStyle().t_focus.getColor()->getPixel());
|
theme->getWindowStyle().t_focus.getColor()->getPixel());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
||||||
&theme->getWindowStyle().t_focus);
|
&theme->getWindowStyle().t_focus);
|
||||||
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
||||||
geom_window, geom_pixmap);
|
geom_window, geom_pixmap);
|
||||||
}
|
}
|
||||||
|
@ -374,7 +391,7 @@ resource(rm, screenname, altscreenname)
|
||||||
theme->getWindowStyle().l_focus.getColor()->getPixel());
|
theme->getWindowStyle().l_focus.getColor()->getPixel());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
geom_pixmap = image_control->renderImage(geom_w, geom_h,
|
||||||
&theme->getWindowStyle().l_focus);
|
&theme->getWindowStyle().l_focus);
|
||||||
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
|
||||||
geom_window, geom_pixmap);
|
geom_window, geom_pixmap);
|
||||||
}
|
}
|
||||||
|
@ -398,13 +415,13 @@ resource(rm, screenname, altscreenname)
|
||||||
}
|
}
|
||||||
|
|
||||||
workspacemenu->insert(i18n->
|
workspacemenu->insert(i18n->
|
||||||
getMessage(
|
getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
IconSet, IconIcons,
|
IconSet, IconIcons,
|
||||||
#else // !NLS
|
#else // !NLS
|
||||||
0, 0,
|
0, 0,
|
||||||
#endif // NLS
|
#endif // NLS
|
||||||
"Icons"),
|
"Icons"),
|
||||||
iconmenu);
|
iconmenu);
|
||||||
workspacemenu->update();
|
workspacemenu->update();
|
||||||
|
|
||||||
|
@ -413,9 +430,9 @@ resource(rm, screenname, altscreenname)
|
||||||
|
|
||||||
toolbar = new Toolbar(this);
|
toolbar = new Toolbar(this);
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit = new Slit(this);
|
slit = new Slit(this);
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
InitMenu();
|
InitMenu();
|
||||||
|
|
||||||
|
@ -423,6 +440,7 @@ resource(rm, screenname, altscreenname)
|
||||||
rootmenu->update();
|
rootmenu->update();
|
||||||
|
|
||||||
changeWorkspaceID(0);
|
changeWorkspaceID(0);
|
||||||
|
updateNetizenWorkspaceCount();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned int nchild;
|
unsigned int nchild;
|
||||||
|
@ -432,21 +450,21 @@ resource(rm, screenname, altscreenname)
|
||||||
|
|
||||||
// preen the window list of all icon windows... for better dockapp support
|
// preen the window list of all icon windows... for better dockapp support
|
||||||
for (i = 0; i < (int) nchild; i++) {
|
for (i = 0; i < (int) nchild; i++) {
|
||||||
|
|
||||||
if (children[i] == None) continue;
|
if (children[i] == None) continue;
|
||||||
|
|
||||||
XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(),
|
XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(),
|
||||||
children[i]);
|
children[i]);
|
||||||
|
|
||||||
if (wmhints) {
|
if (wmhints) {
|
||||||
if ((wmhints->flags & IconWindowHint) &&
|
if ((wmhints->flags & IconWindowHint) &&
|
||||||
(wmhints->icon_window != children[i]))
|
(wmhints->icon_window != children[i]))
|
||||||
for (int j = 0; j < (int) nchild; j++)
|
for (int j = 0; j < (int) nchild; j++) {
|
||||||
if (children[j] == wmhints->icon_window) {
|
if (children[j] == wmhints->icon_window) {
|
||||||
children[j] = None;
|
children[j] = None;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
XFree(wmhints);
|
XFree(wmhints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -840,9 +858,29 @@ void BScreen::removeNetizen(Window w) {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::updateNetizenCurrentWorkspace(void) {
|
void BScreen::updateNetizenCurrentWorkspace(void) {
|
||||||
|
#ifdef NEWWMSPEC
|
||||||
|
//update _NET_WM_CURRENT_DESKTOP
|
||||||
|
int workspace = getCurrentWorkspaceID();
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getNETCurrentDesktopAtom(), XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&workspace, 1);
|
||||||
|
#endif
|
||||||
|
#ifdef GNOME
|
||||||
|
//update _WIN_WORKSPACE
|
||||||
|
int gnome_workspace = getCurrentWorkspaceID();
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&gnome_workspace, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
LinkedListIterator<Netizen> it(netizenList);
|
LinkedListIterator<Netizen> it(netizenList);
|
||||||
for (; it.current(); it++)
|
for (; it.current(); it++)
|
||||||
it.current()->sendCurrentWorkspace();
|
it.current()->sendCurrentWorkspace();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
cerr<<__FILE__<<"("<<__LINE__<<"): Update Current Workspace"<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -850,6 +888,27 @@ void BScreen::updateNetizenWorkspaceCount(void) {
|
||||||
LinkedListIterator<Netizen> it(netizenList);
|
LinkedListIterator<Netizen> it(netizenList);
|
||||||
for (; it.current(); it++)
|
for (; it.current(); it++)
|
||||||
it.current()->sendWorkspaceCount();
|
it.current()->sendWorkspaceCount();
|
||||||
|
|
||||||
|
#ifdef NEWWMSPEC
|
||||||
|
//update _NET_WM_NUMBER_OF_DESKTOPS
|
||||||
|
int numworkspaces = getCount()-1;
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getNETNumberOfDesktopsAtom(), XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&numworkspaces, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GNOME
|
||||||
|
{
|
||||||
|
int numworkspaces = getCount();
|
||||||
|
XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
|
||||||
|
getBaseDisplay()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&numworkspaces, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
cerr<<__FILE__<<"("<<__LINE__<<"): Update Workspace Count"<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue