[mutter] window/wayland: Calculate position also for acked fullscreen configs



commit 47c8063b30c597b0e93f4084f42f86a64cd58e5f
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Mar 4 10:06:19 2022 +0100

    window/wayland: Calculate position also for acked fullscreen configs
    
    An acked fullscreen window also need to have its position updated in
    response to a configure ack, so that it's moved to the right position
    (e.g. correct monitor).
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>

 src/core/constraints.c                          |  5 +++--
 src/wayland/meta-wayland-window-configuration.c |  2 ++
 src/wayland/meta-wayland-window-configuration.h |  2 ++
 src/wayland/meta-window-wayland.c               | 15 +++++++++------
 4 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index f5729354f0..a1140d5f59 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -370,9 +370,10 @@ setup_constraint_info (ConstraintInfo      *info,
     info->action_type = ACTION_RESIZE;
   else if (flags & META_MOVE_RESIZE_MOVE_ACTION)
     info->action_type = ACTION_MOVE;
+  else if (flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE)
+    info->action_type = ACTION_MOVE;
   else
-    g_error ("BAD, BAD developer!  No treat for you!  (Fix your calls to "
-             "meta_window_move_resize_internal()).");
+    g_assert_not_reached ();
 
   info->is_user_action = (flags & META_MOVE_RESIZE_USER_ACTION);
 
diff --git a/src/wayland/meta-wayland-window-configuration.c b/src/wayland/meta-wayland-window-configuration.c
index fb8657017b..ad6228d2f7 100644
--- a/src/wayland/meta-wayland-window-configuration.c
+++ b/src/wayland/meta-wayland-window-configuration.c
@@ -47,6 +47,8 @@ meta_wayland_window_configuration_new (MetaWindow          *window,
     .scale = scale,
     .gravity = gravity,
     .flags = flags,
+
+    .is_fullscreen = meta_window_is_fullscreen (window),
   };
 
   if (flags & META_MOVE_RESIZE_MOVE_ACTION ||
diff --git a/src/wayland/meta-wayland-window-configuration.h b/src/wayland/meta-wayland-window-configuration.h
index a3d184bd83..3e5aaffca9 100644
--- a/src/wayland/meta-wayland-window-configuration.h
+++ b/src/wayland/meta-wayland-window-configuration.h
@@ -50,6 +50,8 @@ struct _MetaWaylandWindowConfiguration
 
   int bounds_width;
   int bounds_height;
+
+  gboolean is_fullscreen;
 };
 
 MetaWaylandWindowConfiguration * meta_wayland_window_configuration_new (MetaWindow          *window,
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index 1ddc061766..e7e35556b5 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -939,9 +939,9 @@ meta_window_wayland_get_geometry_scale (MetaWindow *window)
 }
 
 static void
-calculate_offset (MetaWaylandWindowConfiguration *configuration,
-                  MetaRectangle                  *geometry,
-                  MetaRectangle                  *rect)
+calculate_position (MetaWaylandWindowConfiguration *configuration,
+                    MetaRectangle                  *geometry,
+                    MetaRectangle                  *rect)
 {
   int offset_x;
   int offset_y;
@@ -1043,16 +1043,19 @@ meta_window_wayland_finish_move_resize (MetaWindow              *window,
               rect.x = parent->rect.x + acked_configuration->rel_x;
               rect.y = parent->rect.y + acked_configuration->rel_y;
             }
-          else if (acked_configuration->has_position)
+          else
             {
-              calculate_offset (acked_configuration, &new_geom, &rect);
+              if (acked_configuration->is_fullscreen)
+                flags |= META_MOVE_RESIZE_CONSTRAIN;
+              if (acked_configuration->has_position)
+                calculate_position (acked_configuration, &new_geom, &rect);
             }
         }
     }
   else
     {
       if (acked_configuration && acked_configuration->has_position)
-        calculate_offset (acked_configuration, &new_geom, &rect);
+        calculate_position (acked_configuration, &new_geom, &rect);
     }
 
   rect.x += dx;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]