From 227cf56f443d1ce45fce2e13a4daf442a29bc862 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 19 Jul 2011 14:50:04 +0200 Subject: Add native error handler for systray --- csrc/SystrayErrorHandler.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 csrc/SystrayErrorHandler.c (limited to 'csrc') diff --git a/csrc/SystrayErrorHandler.c b/csrc/SystrayErrorHandler.c new file mode 100644 index 0000000..29e7fa1 --- /dev/null +++ b/csrc/SystrayErrorHandler.c @@ -0,0 +1,27 @@ +#include + + +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; +} -- cgit v1.2.3