From 2a62e690a21f98c22549d8a8c8a9b39916e1bc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 4 Mar 2022 09:57:49 +0100 Subject: [PATCH] window/wayland: Use scale for configured rect in configuration When a window configuration is constructed for a Wayland surface it contains a position, size and a scale. The scale is the geometry scale for the configuration, i.e. before the size is sent the passed dimension is divided with the passed scale. When moving between monitors with different scales, if we use the existing geometry scale, this means we will send a configure event with incorrect dimensions. Fix this by calculating the scale used in the configuration given the rect we're configuring with as this will mean the correct size will be sent to the client. v2: Removed the fullscreen condition. Don't know why it was added to begin with. Part-of: --- src/wayland/meta-window-wayland.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 878e448bd..1ddc06176 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -996,7 +996,14 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, * scale new_geom to physical pixels given what buffer scale and texture scale * is in use. */ - geometry_scale = meta_window_wayland_get_geometry_scale (window); + acked_configuration = acquire_acked_configuration (wl_window, pending, + &is_client_resize); + + if (acked_configuration) + geometry_scale = acked_configuration->scale; + else + geometry_scale = meta_window_wayland_get_geometry_scale (window); + new_geom.x *= geometry_scale; new_geom.y *= geometry_scale; new_geom.width *= geometry_scale; @@ -1013,9 +1020,6 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, flags = META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE; - acked_configuration = acquire_acked_configuration (wl_window, pending, - &is_client_resize); - /* x/y are ignored when we're doing interactive resizing */ is_window_being_resized = (meta_grab_op_is_resizing (display->grab_op) && display->grab_window == window);