[mutter] window: Add proper interpretation of dx/dy



commit c1f4352683f70c97cd2aca25cb4c6c4a834f1fcc
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 16 16:26:23 2014 -0400

    window: Add proper interpretation of dx/dy
    
    dx/dy should be against the regular window's rect, and need to
    be ignored when we're resizing. Instead, we use gravity to anchor
    the window's new rectangle when resizing.

 src/core/window-private.h    |    6 ------
 src/core/window.c            |   17 +++++++++++++----
 src/wayland/window-wayland.c |    5 -----
 3 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index cf69a7d..89c2b7b 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -415,12 +415,6 @@ struct _MetaWindow
    */
   MetaRectangle rect;
 
-  /* The size and position we want the window to be (i.e. what we last asked
-   * the client to configure).
-   * This is only used for wayland clients.
-   */
-  MetaRectangle expected_rect;
-
   gboolean has_custom_frame_extents;
   GtkBorder custom_frame_extents;
 
diff --git a/src/core/window.c b/src/core/window.c
index afedcfb..9db3bf3 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4405,14 +4405,23 @@ meta_window_move_resize_wayland (MetaWindow *window,
   flags = META_IS_WAYLAND_RESIZE;
 
   meta_window_get_position (window, &x, &y);
-  x += dx; y += dy;
 
-  if (x != window->expected_rect.x || y != window->expected_rect.y)
-    flags |= META_IS_MOVE_ACTION;
+  /* dx/dy are ignored during resizing */
+  if (!meta_grab_op_is_resizing (window->display->grab_op))
+    {
+      if (dx != 0 || dy != 0)
+        {
+          x += dx;
+          y += dy;
+          flags |= META_IS_MOVE_ACTION;
+        }
+    }
+
   if (width != window->rect.width || height != window->rect.height)
     flags |= META_IS_RESIZE_ACTION;
 
-  meta_window_move_resize_internal (window, flags, NorthWestGravity,
+  meta_window_move_resize_internal (window, flags,
+                                    meta_resize_gravity_from_grab_op (window->display->grab_op),
                                     x, y, width, height);
   save_user_window_placement (window);
 }
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 523c919..64df0fc 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -131,11 +131,6 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
    * it can be for maximized or fullscreen.
    */
 
-  /* First, save where we would like the client to be. This is used by the next
-   * attach to determine if the client is really moving/resizing or not.
-   */
-  window->expected_rect = constrained_rect;
-
   if (flags & META_IS_WAYLAND_RESIZE)
     {
       /* This is a call to wl_surface_commit(), ignore the constrained_rect and


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