xwayland: Handle rootful resize in ResizeWindow

Commit fa7b1c20 ("xwayland: Use ConfigNotify screen hook instead of
ResizeWindow") replaced the WindowResize hook with ConfigNotify.

However, that's breaking rootful Xwayland with libdecor because the root
window size is already set so the libdecor size is not updated, and the
root size will be reverted back as soon as the focus changes.

Reinstate the rootful size change in ResizeWindow to avoid that issue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1669
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1671
Fixes: fa7b1c20 - xwayland: Use ConfigNotify screen hook instead of ResizeWindow
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
This commit is contained in:
Olivier Fourdan 2024-05-06 11:39:32 +02:00 committed by Marge Bot
parent 539859bde0
commit 31d6f9998d

View File

@ -1814,17 +1814,6 @@ xwl_config_notify(WindowPtr window,
if (size_changed && xwl_window) {
if (xwl_window_get(window) || xwl_window_is_toplevel(window))
xwl_window_check_resolution_change_emulation(xwl_window);
if (window == screen->root) {
#ifdef XWL_HAS_LIBDECOR
unsigned int decor_width, decor_height;
decor_width = width / xwl_screen->global_surface_scale;
decor_height = height / xwl_screen->global_surface_scale;
xwl_window_update_libdecor_size(xwl_window, NULL,
decor_width, decor_height);
#endif
xwl_window_check_fractional_scale_viewport(xwl_window, width, height);
}
}
return ret;
@ -1838,13 +1827,29 @@ xwl_resize_window(WindowPtr window,
{
ScreenPtr screen = window->drawable.pScreen;
struct xwl_screen *xwl_screen;
struct xwl_window *xwl_window;
xwl_screen = xwl_screen_get(screen);
xwl_window = xwl_window_from_window(window);
screen->ResizeWindow = xwl_screen->ResizeWindow;
screen->ResizeWindow(window, x, y, width, height, sib);
xwl_screen->ResizeWindow = screen->ResizeWindow;
screen->ResizeWindow = xwl_resize_window;
if (xwl_window) {
if (window == screen->root) {
#ifdef XWL_HAS_LIBDECOR
unsigned int decor_width, decor_height;
decor_width = width / xwl_screen->global_surface_scale;
decor_height = height / xwl_screen->global_surface_scale;
xwl_window_update_libdecor_size(xwl_window, NULL,
decor_width, decor_height);
#endif
xwl_window_check_fractional_scale_viewport(xwl_window, width, height);
}
}
}
void