diff options
Diffstat (limited to 'csrc')
-rw-r--r-- | csrc/SystrayErrorHandler.c | 27 |
1 files changed, 27 insertions, 0 deletions
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 <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; +} |