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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
This commit is contained in:
Jonas Ådahl 2022-03-04 09:57:49 +01:00 committed by Marge Bot
parent f4645b0a37
commit 2a62e690a2

View File

@ -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);