[mutter/cherry-pick-8bdd2aa7-2] window/wayland: Offset position with size mismatch when resizing
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/cherry-pick-8bdd2aa7-2] window/wayland: Offset position with size mismatch when resizing
- Date: Wed, 7 Oct 2020 15:41:30 +0000 (UTC)
commit 6721d61189f710567593b2d9c736c13233cba07a
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Oct 7 14:01:17 2020 +0000
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
(cherry picked from commit 8bdd2aa7dbb80594b37fa384cf6a4c1007e29852)
src/wayland/meta-window-wayland.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index ab5b7f86ea..ce265a6fe4 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -956,8 +956,31 @@ meta_window_wayland_finish_move_resize (MetaWindow *window,
{
if (acked_configuration)
{
+ int offset_x;
+ int offset_y;
+
rect.x = acked_configuration->x;
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;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]