summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-04-05 17:01:29 +0200
committerHans de Goede <hdegoede@redhat.com>2013-04-09 11:54:24 +0200
commit7d07bb7197862bebd723861c676acd1eeaa8bb4f (patch)
tree2158a3f7c61cbc252796c908d14c81993b14e89b /src
parente0d8434b063a4f736550fe04a77f64e977065c3a (diff)
downloadvd_agent-7d07bb7197862bebd723861c676acd1eeaa8bb4f.tar.gz
vd_agent-7d07bb7197862bebd723861c676acd1eeaa8bb4f.tar.xz
vd_agent-7d07bb7197862bebd723861c676acd1eeaa8bb4f.zip
vdagent-x11: Add set_error_handler / restore_error_handler helpers
This is #if 0-ified for now, to avoid breaking compilation with -Werror. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/vdagent-x11.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
index 63349b3..cb70a91 100644
--- a/src/vdagent-x11.c
+++ b/src/vdagent-x11.c
@@ -43,6 +43,11 @@
#include "vdagent-x11.h"
#include "vdagent-x11-priv.h"
+#if 0
+/* Stupid X11 API, there goes our encapsulate all data in a struct design */
+static int (*vdagent_x11_prev_error_handler)(Display *, XErrorEvent *);
+#endif
+
static void vdagent_x11_handle_selection_notify(struct vdagent_x11 *x11,
XEvent *event, int incr);
static void vdagent_x11_handle_selection_request(struct vdagent_x11 *x11);
@@ -68,11 +73,25 @@ static const char *vdagent_x11_sel_to_str(uint8_t selection) {
}
}
-static int debug_error_handler(Display *display, XErrorEvent *error)
+static int vdagent_x11_debug_error_handler(
+ Display *display, XErrorEvent *error)
{
abort();
}
+#if 0
+static void vdagent_x11_set_error_handler(
+ int (*handler)(Display *, XErrorEvent *))
+{
+ vdagent_x11_prev_error_handler = XSetErrorHandler(handler);
+}
+
+static void vdagent_x11_restore_error_handler(void)
+{
+ XSetErrorHandler(vdagent_x11_prev_error_handler);
+}
+#endif
+
struct vdagent_x11 *vdagent_x11_create(struct udscs_connection *vdagentd,
int debug, int sync)
{
@@ -97,7 +116,7 @@ struct vdagent_x11 *vdagent_x11_create(struct udscs_connection *vdagentd,
}
if (sync) {
- XSetErrorHandler(debug_error_handler);
+ XSetErrorHandler(vdagent_x11_debug_error_handler);
XSynchronize(x11->display, True);
}