From 6d00c2bc1077c9e1e870303b1b49ec694089fc4e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 24 Jul 2023 17:03:56 +0200 Subject: [PATCH] xwayland: attach new buffer from libdecor handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The configure handler in libdecor is triggered any time a new configuration is received. According to the documentation from libdecor, an application should respond to that event by creating a suitable libdecor_state, and apply it using libdecor_frame_commit(). So we ought to attach a new buffer matching the new size and commit the Wayland surface. The actual content of the window does not need to be explicitly repainted, that occurs through the call to SetRootClip(): xwl_output_set_mode_fixed() -> update_screen_size() -> SetRootClip() -> miHandleValidateExposures() -> miWindowExposures() -> miPaintWindow() This fixes an issue with mutter where maximizing a window and then switching to another window would sometimes resize the Xwayland window back to its pre-maximized size, or with Weston where the Xwayland window would initially show up black until the pointer moves to the window. Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 72c832e4e..0951e47cd 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -629,6 +629,9 @@ xwl_window_libdecor_resize(struct xwl_window *xwl_window, int width, int height) mode = xwl_output_find_mode(xwl_output, width, height); xwl_output_set_mode_fixed(xwl_output, mode); + + xwl_window_attach_buffer(xwl_window); + wl_surface_commit(xwl_window->surface); } static void @@ -652,8 +655,6 @@ handle_libdecor_configure(struct libdecor_frame *frame, state = libdecor_state_new(xwl_screen->width, xwl_screen->height); libdecor_frame_commit(frame, state, configuration); libdecor_state_free(state); - - wl_surface_commit(xwl_window->surface); } static void