diff options
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/x11/x11-overlay.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/overlay/x11/x11-overlay.c b/overlay/x11/x11-overlay.c index 38d58b07..d08ebfc9 100644 --- a/overlay/x11/x11-overlay.c +++ b/overlay/x11/x11-overlay.c @@ -111,6 +111,14 @@ static void x11_overlay_destroy(void *data) free(priv); } +static int x_error_count; + +static int check_error_handler(Display *display, XErrorEvent *event) +{ + x_error_count++; + return False; /* ignored */ +} + cairo_surface_t * x11_overlay_create(struct config *config, int *width, int *height) { @@ -133,6 +141,8 @@ x11_overlay_create(struct config *config, int *width, int *height) if (dpy == NULL) return NULL; + XSetErrorHandler(check_error_handler); + scr = ScreenOfDisplay(dpy, DefaultScreen(dpy)); fd = dri2_open(dpy); @@ -164,6 +174,9 @@ x11_overlay_create(struct config *config, int *width, int *height) if (port == -1) goto err_fd; + if (x_error_count) + goto err_fd; + XSetErrorHandler(noop); position = x11_position(dpy, *width, *height, config, &x, &y, &w, &h); |