Add native error handler for systray

This commit is contained in:
Matthias Schiffer 2011-07-19 14:50:04 +02:00
parent bc9f8e1fbc
commit 227cf56f44
6 changed files with 73 additions and 26 deletions

View file

@ -0,0 +1,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;
}