[mutter] window-wayland: Fix resizing from the top/left once more



commit b773898a6059655fc0074d4009313ecc821c02df
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 28 18:15:03 2014 -0400

    window-wayland: Fix resizing from the top/left once more
    
    Restoring the position in our move_resize_internal implementation
    is too late. We need to do it at ack-time, before we hand off the
    new position to the constraints code.

 src/wayland/window-wayland.c |   37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)
---
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 1009cd5..80ea30e 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -125,7 +125,6 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
 {
   MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
   gboolean should_move = FALSE;
-  gboolean use_saved_pos = FALSE;
 
   g_assert (window->frame == NULL);
 
@@ -152,7 +151,6 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
       /* This is a commit of an attach. We should move the window to match the
        * new position the client wants. */
       should_move = TRUE;
-      use_saved_pos = TRUE;
     }
 
   if (constrained_rect.width != window->rect.width ||
@@ -175,26 +173,8 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
 
   if (should_move)
     {
-      int new_x, new_y;
-
-      if (use_saved_pos && wl_window->has_saved_pos)
-        {
-          int dx, dy;
-
-          /* The dx/dy that the client asked for. */
-          dx = requested_rect.x - window->rect.x;
-          dy = requested_rect.y - window->rect.y;
-
-          new_x = wl_window->saved_x + dx;
-          new_y = wl_window->saved_y + dy;
-
-          wl_window->has_saved_pos = FALSE;
-        }
-      else
-        {
-          new_x = constrained_rect.x;
-          new_y = constrained_rect.y;
-        }
+      int new_x = constrained_rect.x;
+      int new_y = constrained_rect.y;
 
       if (new_x != window->rect.x || new_y != window->rect.y)
         {
@@ -236,12 +216,23 @@ meta_window_wayland_move_resize (MetaWindow *window,
                                  int         dx,
                                  int         dy)
 {
+  MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
   int x, y;
   MetaMoveResizeFlags flags;
 
   flags = META_IS_WAYLAND_RESIZE;
 
-  meta_window_get_position (window, &x, &y);
+  if (wl_window->has_saved_pos)
+    {
+      x = wl_window->saved_x;
+      y = wl_window->saved_y;
+      wl_window->has_saved_pos = FALSE;
+      flags |= META_IS_MOVE_ACTION;
+    }
+  else
+    {
+      meta_window_get_position (window, &x, &y);
+    }
 
   /* dx/dy are ignored during resizing */
   if (!meta_grab_op_is_resizing (window->display->grab_op))


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