summaryrefslogtreecommitdiffstats
path: root/csrc/SystrayErrorHandler.c
blob: 29e7fa1ed9eca9cb6df72dd25c4c77604d5887e7 (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
#include <SystrayErrorHandler.h>


static Window lastErrorWindow = 0;


static int systrayErrorHandler (Display *display, XErrorEvent *event)
{
	if (event->error_code == BadWindow) {
		lastErrorWindow = event->resourceid;
	}

	return 0;
}

void setSystrayErrorHandler (void)
{
	lastErrorWindow = 0;
	XSetErrorHandler(systrayErrorHandler);
}

Window getLastErrorWindow (void)
{
	Window ret = lastErrorWindow;
	lastErrorWindow = 0;
	return ret;
}