From 4990ed99ebc8eeb508e0077f620ec2df781fabdb Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sun, 26 Nov 2023 00:51:50 +0300 Subject: [PATCH] backend/x11: don't send ConfigureRequest with the same size Under X11, ConfigureNotify means that the window has already been resized. Sending ConfigureRequest with the received size is not only useless, but also can confuse the window manager, which will probably reply with the current (i.e. *old*) size causing a configure loop. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3769 --- backend/x11/output.c | 13 +++++++++++++ include/backend/x11.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/backend/x11/output.c b/backend/x11/output.c index 585e037a..58c90a89 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -63,6 +63,10 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); struct wlr_x11_backend *x11 = output->x11; + if (width == output->win_width && height == output->win_height) { + return true; + } + const uint32_t values[] = { width, height }; xcb_void_cookie_t cookie = xcb_configure_window_checked( x11->xcb, output->win, @@ -76,6 +80,9 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, return false; } + output->win_width = width; + output->win_height = height; + // Move the pointer to its new location update_x11_pointer_position(output, output->x11->time); @@ -598,6 +605,9 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { x11->screen->root, 0, 0, wlr_output->width, wlr_output->height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->visualid, mask, values); + output->win_width = wlr_output->width; + output->win_height = wlr_output->height; + struct { xcb_input_event_mask_t head; xcb_input_xi_event_mask_t mask; @@ -659,6 +669,9 @@ void handle_x11_configure_notify(struct wlr_x11_output *output, return; } + output->win_width = ev->width; + output->win_height = ev->height; + struct wlr_output_state state; wlr_output_state_init(&state); wlr_output_state_set_custom_mode(&state, ev->width, ev->height, 0); diff --git a/include/backend/x11.h b/include/backend/x11.h index 06834c1c..9eb208b1 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -35,6 +35,8 @@ struct wlr_x11_output { xcb_window_t win; xcb_present_event_t present_event_id; + int32_t win_width, win_height; + struct wlr_pointer pointer; struct wlr_touch touch;