[mutter/cherry-pick-8bdd2aa7] window/wayland: Offset position with size mismatch when resizing




commit 911958cce765ea1f379151453dc5aafc154a8d62
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 a942dc9a3f..9a33f73e00 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]