window/wayland: Offset position with size mismatch when resizing

When we resize a window we send it configure requests with size
suggestion. Some clients, e.g. gnome-terminal will limit its size to a
discrete set given the font size resulting in the size often not being
respected completely, but used as a hint to find a size as large as
possible but not larger than the configured size.

When doing an interactive resize dragging the right or top side of a
window, this caused issues with the configured window size not matching
the one used by the client, as the configured position wouldn't be
correct for the actual size. Fix this by offsetting the position given
the size mismatch offset, making the position again in sync with the
size.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1447

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1477
This commit is contained in:
Jonas Ådahl 2020-10-07 16:01:17 +02:00
parent c7ab5f3f03
commit 8bdd2aa7db

View File

@ -956,8 +956,31 @@ meta_window_wayland_finish_move_resize (MetaWindow *window,
{ {
if (acked_configuration) if (acked_configuration)
{ {
int offset_x;
int offset_y;
rect.x = acked_configuration->x; rect.x = acked_configuration->x;
rect.y = acked_configuration->y; rect.y = acked_configuration->y;
offset_x = acked_configuration->width - new_geom.width;
offset_y = acked_configuration->height - new_geom.height;
switch (acked_configuration->gravity)
{
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_WEST:
rect.y += offset_y;
break;
case META_GRAVITY_EAST:
case META_GRAVITY_NORTH_EAST:
rect.x += offset_x;
break;
case META_GRAVITY_SOUTH_EAST:
rect.x += offset_x;
rect.y += offset_y;
break;
default:
break;
}
} }
} }