From 55cca6deaa4813a407cfecccf21478671a96d11e Mon Sep 17 00:00:00 2001 From: sdilts Date: Thu, 9 Aug 2018 22:05:18 -0600 Subject: Set default output size for X11 backend Fixes issue #1170 Also set the created window size to match the output size. --- backend/x11/output.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'backend/x11/output.c') diff --git a/backend/x11/output.c b/backend/x11/output.c index 151807dd..3be63d5f 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -121,6 +121,9 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { struct wlr_output *wlr_output = &output->wlr_output; wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display); + wlr_output->width = 1024; + wlr_output->height = 768; + output_set_refresh(&output->wlr_output, 0); snprintf(wlr_output->name, sizeof(wlr_output->name), "X11-%d", @@ -137,8 +140,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { }; output->win = xcb_generate_id(x11->xcb_conn); xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, - x11->screen->root, 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, - x11->screen->root_visual, mask, values); + x11->screen->root, wlr_output->width, wlr_output->height, 1024, 768, 1, + XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values); output->surf = wlr_egl_create_surface(&x11->egl, &output->win); if (!output->surf) { -- cgit v1.2.3 From da79fef5f7d3fc7a27b5813e2e94bcf28b54da8b Mon Sep 17 00:00:00 2001 From: sdilts Date: Thu, 9 Aug 2018 22:09:48 -0600 Subject: Add guard for changing the size of X11 backend windows Events that set the window to either a width or height of zero are now ignored and logged. --- backend/x11/output.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'backend/x11/output.c') diff --git a/backend/x11/output.c b/backend/x11/output.c index 3be63d5f..867a3594 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -190,11 +190,17 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { void handle_x11_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *ev) { - wlr_output_update_custom_mode(&output->wlr_output, ev->width, - ev->height, output->wlr_output.refresh); - - // Move the pointer to its new location - update_x11_pointer_position(output, output->x11->time); + // ignore events that set an invalid size: + if (ev->width > 0 && ev->height > 0) { + wlr_output_update_custom_mode(&output->wlr_output, ev->width, + ev->height, output->wlr_output.refresh); + + // Move the pointer to its new location + update_x11_pointer_position(output, output->x11->time); + } else { + wlr_log(WLR_DEBUG,"Ignoring X11 configure event for height=%d, width=%d", + ev->width, ev->height); + } } bool wlr_output_is_x11(struct wlr_output *wlr_output) { -- cgit v1.2.3 From 8e7df5eb88dd5ec682b3293bf02a4a7b09c59489 Mon Sep 17 00:00:00 2001 From: sdilts Date: Fri, 10 Aug 2018 18:05:34 -0600 Subject: Fix xcb_create_window parameters Set the window width and height, not the location of the window. --- backend/x11/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backend/x11/output.c') diff --git a/backend/x11/output.c b/backend/x11/output.c index 867a3594..b678296d 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -140,7 +140,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { }; output->win = xcb_generate_id(x11->xcb_conn); xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, - x11->screen->root, wlr_output->width, wlr_output->height, 1024, 768, 1, + x11->screen->root, 0, 0, wlr_output->width, wlr_output->height, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values); output->surf = wlr_egl_create_surface(&x11->egl, &output->win); -- cgit v1.2.3