summaryrefslogtreecommitdiff
path: root/src/utils.c
blob: c99e74c9d9bc27546ff119c03c8adc78adff93a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <err.h>
#include <X11/Xlib.h>
#include "util.h"

void
otherwm(void)
{
	XSetErrorHandler(otherwmerr);
	XChangeWindowAttributes(dpy, root, CWEventMask, 
			&(XSetWindowAttributes){.event_mask = SubstructureRedirectMask});
	XSync(dpy, False);
	XSetErrorHandler(xerr);
	XSync(dpy, False);
}

int
otherwmerr(Display *dpy, XErrorEvent *ee)
{
	errx(0, "sxwm: another window manager is already running, please close it");
	return 0;
	if (dpy && ee) return 0;
}

int
xerr(Display *dpy, XErrorEvent *ee)
{
	fprintf(stderr, "sxwm: fatal error\nrequest code:%d\nerror code:%d",
			ee->request_code, ee->error_code);
	return 0;
	if (dpy && ee) return 0;
}