mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
Removed the startup_error_handler
This commit is contained in:
parent
6c47a05c63
commit
e5982aec2f
24
main.c
24
main.c
@ -19,7 +19,6 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
static int other_wm_running;
|
||||
static int (*x_error_handler) (Display *, XErrorEvent *);
|
||||
static char version[] = "wmiiwm - " VERSION ", (C)opyright MMIV-MMVI Anselm R. Garbe\n";
|
||||
|
||||
@ -154,6 +153,8 @@ init_screen(WMScreen *screen) {
|
||||
*/
|
||||
int
|
||||
wmii_error_handler(Display *dpy, XErrorEvent *error) {
|
||||
if(starting)
|
||||
ixp_eprint("wmiiwm: another window manager is already running\n");
|
||||
if(error->error_code == BadWindow
|
||||
|| (error->request_code == X_SetInputFocus
|
||||
&& error->error_code == BadMatch)
|
||||
@ -173,16 +174,6 @@ wmii_error_handler(Display *dpy, XErrorEvent *error) {
|
||||
return x_error_handler(blz.dpy, error); /* calls exit() */
|
||||
}
|
||||
|
||||
/*
|
||||
* Startup Error handler to check if another window manager
|
||||
* is already running.
|
||||
*/
|
||||
static int
|
||||
startup_error_handler(Display * dpy, XErrorEvent * error) {
|
||||
other_wm_running = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup() {
|
||||
Client *c;
|
||||
@ -230,6 +221,7 @@ main(int argc, char *argv[]) {
|
||||
usage();
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
starting = True;
|
||||
|
||||
blz.dpy = XOpenDisplay(0);
|
||||
if(!blz.dpy)
|
||||
@ -237,14 +229,9 @@ main(int argc, char *argv[]) {
|
||||
blz.screen = DefaultScreen(blz.dpy);
|
||||
blz.root = RootWindow(blz.dpy, blz.screen);
|
||||
|
||||
/* check if another WM is already running */
|
||||
other_wm_running = 0;
|
||||
XSetErrorHandler(startup_error_handler);
|
||||
/* this causes an error if some other WM is running */
|
||||
x_error_handler = XSetErrorHandler(wmii_error_handler);
|
||||
XSelectInput(blz.dpy, blz.root, SubstructureRedirectMask | EnterWindowMask);
|
||||
XSync(blz.dpy, False);
|
||||
if(other_wm_running)
|
||||
ixp_eprint("wmiiwm: another window manager is already running\n");
|
||||
|
||||
/* Check namespace permissions */
|
||||
if(!strncmp(address, "unix!", 5)) {
|
||||
@ -267,8 +254,6 @@ main(int argc, char *argv[]) {
|
||||
free(namespace);
|
||||
}
|
||||
|
||||
XSetErrorHandler(0);
|
||||
x_error_handler = XSetErrorHandler(wmii_error_handler);
|
||||
errstr = nil;
|
||||
i = ixp_create_sock(address, &errstr);
|
||||
if(i < 0)
|
||||
@ -366,7 +351,6 @@ main(int argc, char *argv[]) {
|
||||
|
||||
screen = &screens[0];
|
||||
|
||||
starting = True;
|
||||
scan_wins();
|
||||
update_views();
|
||||
starting = False;
|
||||
|
Loading…
Reference in New Issue
Block a user