Add native error handler for systray
This commit is contained in:
parent
bc9f8e1fbc
commit
227cf56f44
6 changed files with 73 additions and 26 deletions
27
csrc/SystrayErrorHandler.c
Normal file
27
csrc/SystrayErrorHandler.c
Normal 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;
|
||||
}
|
Reference in a new issue