From b51462d001dfe64608f57946ade2a76eb9191b41 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Sat, 2 Sep 2023 22:12:08 +0300 Subject: [PATCH] backend-wayland: Don't signal out resize events for activation This should avoid spurious signal events received by the shell in order to resize its buffer. As we can have resize events being sent even if xdg-shell activation doesn't happen, make use of the output dimensions to determine if we need do send out a resize event or not. Signed-off-by: Marius Vlad --- libweston/backend-wayland/wayland.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c index 89442d052..b5e8971b3 100644 --- a/libweston/backend-wayland/wayland.c +++ b/libweston/backend-wayland/wayland.c @@ -1161,6 +1161,7 @@ handle_xdg_toplevel_configure(void *data, struct xdg_toplevel *toplevel, struct wl_array *states) { struct wayland_output *output = data; + bool should_send_resize = false; output->parent.configure_width = width; output->parent.configure_height = height; @@ -1175,10 +1176,16 @@ handle_xdg_toplevel_configure(void *data, struct xdg_toplevel *toplevel, width -= left + right; height -= top + bottom; } + + if (output->native_mode.width != width || + output->native_mode.height != height) + should_send_resize = true; + output->native_mode.width = width; output->native_mode.height = height; - if (weston_output_mode_set_native(&output->base, + if (should_send_resize && + weston_output_mode_set_native(&output->base, &output->native_mode, output->base.current_scale) < 0) { output->native_mode.width = output->mode.width;