JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
A better fix.
authorReginald Kennedy <rk@rejii.com>
Wed, 18 Jul 2012 11:54:29 +0000 (19:54 +0800)
committerReginald Kennedy <rk@rejii.com>
Fri, 20 Jul 2012 22:00:02 +0000 (06:00 +0800)
Explicitly set event queue owner to XCB since it is Xlib by default.
Xlib errors are now passed to the XCB event queue!

spectrwm.c

index cd6ca79..cd62916 100644 (file)
@@ -256,7 +256,6 @@ volatile sig_atomic_t   running = 1;
 volatile sig_atomic_t   restart_wm = 0;
 int                    outputs = 0;
 /*int                  last_focus_event = FocusOut;*/
-int                    (*xerrorxlib)(Display *, XErrorEvent *);
 int                    other_wm;
 int                    ss_enabled = 0;
 int                    xrandr_support;
@@ -7622,17 +7621,6 @@ event_handle(xcb_generic_event_t *evt)
                screenchange((void *)evt);
 }
 
-xerror(Display *d, XErrorEvent *ee)
-{
-#ifdef SWM_DEBUG
-       char error_text[1024];
-       XGetErrorText(display, ee->error_code, error_text, sizeof(error_text));
-       DNPRINTF(SWM_D_MISC, "xerror: error_code: %u, error_text: %s\n",
-           ee->error_code, error_text);
-#endif
-       return -1;
-}
-
 int
 main(int argc, char *argv[])
 {
@@ -7671,13 +7659,12 @@ main(int argc, char *argv[])
        if (!(display = XOpenDisplay(0)))
                errx(1, "can not open display");
 
-       /* prevent xlib from exiting on an error */
-       xerrorxlib = XSetErrorHandler(xerror);
-
        conn = XGetXCBConnection(display);
        if (xcb_connection_has_error(conn))
                errx(1, "can not get XCB connection");
 
+       XSetEventQueueOwner(display, XCBOwnsEventQueue);
+
        xcb_prefetch_extension_data(conn, &xcb_randr_id);
        xfd = xcb_get_file_descriptor(conn);