From e463b49166841f71c6ee9b8922ae5dc8973174ce Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 11 Jul 2018 17:29:41 +0200 Subject: x11: Check if xcb_configure_window worked So far we did not check for any errors --- backend/x11/output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'backend/x11') diff --git a/backend/x11/output.c b/backend/x11/output.c index 9f8918ab..151807dd 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -47,8 +47,16 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, output_set_refresh(&output->wlr_output, refresh); const uint32_t values[] = { width, height }; - xcb_configure_window(x11->xcb_conn, output->win, + xcb_void_cookie_t cookie = xcb_configure_window_checked(x11->xcb_conn, output->win, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); + + xcb_generic_error_t *error; + if ((error = xcb_request_check(x11->xcb_conn, cookie))) { + wlr_log(WLR_ERROR, "Could not set window size to %dx%d\n", width, height); + free(error); + return false; + } + return true; } -- cgit v1.2.3 From 8515b7c65b884ff2c6bb1b206e3ad0d8bfb841a4 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 11 Jul 2018 17:30:45 +0200 Subject: x11: use correct type for events in wl_event_loop_add_fd --- backend/x11/backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backend/x11') diff --git a/backend/x11/backend.c b/backend/x11/backend.c index cbe4833b..f5619207 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -258,7 +258,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, int fd = xcb_get_file_descriptor(x11->xcb_conn); struct wl_event_loop *ev = wl_display_get_event_loop(display); - int events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP; + uint32_t events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP; x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11); if (!x11->event_source) { wlr_log(WLR_ERROR, "Could not create event source"); -- cgit v1.2.3 From 40fe252c2dea81c5a248c16b6c1b80e57b6a6a70 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 11 Jul 2018 17:31:05 +0200 Subject: x11: make sure event source is drained Otherwise running under Xvfb will not deliver any events. This results in e.g. weston-info reporting a 0x0 window size (which results in all sorts of problems). --- backend/x11/backend.c | 1 + 1 file changed, 1 insertion(+) (limited to 'backend/x11') diff --git a/backend/x11/backend.c b/backend/x11/backend.c index f5619207..e0f5d6e7 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -264,6 +264,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, wlr_log(WLR_ERROR, "Could not create event source"); goto error_display; } + wl_event_source_check(x11->event_source); x11->screen = xcb_setup_roots_iterator(xcb_get_setup(x11->xcb_conn)).data; -- cgit v1.2.3