wmfs: Add checkotherwm function

This commit is contained in:
Martin Duquesnoy 2008-10-16 21:55:33 +02:00
parent 187029fc90
commit 90324e08c4
2 changed files with 24 additions and 12 deletions

View File

@ -32,6 +32,28 @@
#include "wmfs.h"
void
checkotherwm(void)
{
owm = False;
XSetErrorHandler(errorhandlerstart);
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
XSync(dpy, False);
if(owm)
{
fprintf(stderr, "WMFS Error: Another Window Manager is already running.\n");
exit(EXIT_FAILURE);
}
XSetErrorHandler(errorhandler);
XSync(dpy, False);
return;
}
int
errorhandler(Display *d, XErrorEvent *event)
{
@ -301,18 +323,7 @@ main(int argc, char **argv)
}
/* Check if an other WM is already running */
owm = False;
XSetErrorHandler(errorhandlerstart);
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
XSync(dpy, False);
if(owm)
{
fprintf(stderr, "WMFS Error: Another Window Manager is already running.\n");
exit(EXIT_FAILURE);
}
XSetErrorHandler(errorhandler);
XSync(dpy, False);
checkotherwm();
/* Let's Go ! */
init_conf();

View File

@ -157,6 +157,7 @@ void uicb_set_mwfact(uicb_t);
void uicb_set_nmaster(uicb_t);
/* wmfs.c */
void checkotherwm(void);
int errorhandler(Display *d, XErrorEvent *event);
int errorhandlerdummy(Display *d, XErrorEvent *event);
int errorhandlerstart(Display *d, XErrorEvent *event);