summaryrefslogtreecommitdiffstats
path: root/csrc
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-07-19 14:50:04 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-07-19 14:50:04 +0200
commit227cf56f443d1ce45fce2e13a4daf442a29bc862 (patch)
tree0d53ff45098d54e49099aa45afc992ffc4c0fd63 /csrc
parentbc9f8e1fbc7e117ec5368d2d74742cdb2c5f22f7 (diff)
downloadphi-227cf56f443d1ce45fce2e13a4daf442a29bc862.tar
phi-227cf56f443d1ce45fce2e13a4daf442a29bc862.zip
Add native error handler for systray
Diffstat (limited to 'csrc')
-rw-r--r--csrc/SystrayErrorHandler.c27
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;
+}