[mutter] wayland: Simplify the move/resize code



commit 260b6d02f286f8106945e2e2516dd8cdc58ef726
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 16 16:16:01 2014 -0400

    wayland: Simplify the move/resize code
    
    The old protocol is out of date and broken for resizing at the
    top/left. This is still as broken, but a lot simpler.

 src/wayland/window-wayland.c |   44 +++--------------------------------------
 1 files changed, 4 insertions(+), 40 deletions(-)
---
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index e52c143..523c919 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -149,52 +149,16 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
   if (constrained_rect.width != window->rect.width ||
       constrained_rect.height != window->rect.height)
     {
-      /* We need to resize the client. Resizing is in two parts:
-       * some of the movement happens immediately, and some happens as part
-       * of the resizing (through dx/dy in wl_surface_attach).
-       *
-       * To do so, we need to compute the resize from the point of the view
-       * of the client, and then adjust the immediate resize to match.
-       *
-       * dx/dy are the values we expect from the new attach(), while deltax/
-       * deltay reflect the overall movement.
-       */
-      MetaRectangle old_rect;
-      MetaRectangle client_rect;
-      int dx, dy;
-      int deltax, deltay;
-
-      meta_window_get_client_root_coords (window, &old_rect);
-
-      meta_rectangle_resize_with_gravity (&old_rect,
-                                          &client_rect,
-                                          gravity,
-                                          constrained_rect.width,
-                                          constrained_rect.height);
-
-      deltax = constrained_rect.x - old_rect.x;
-      deltay = constrained_rect.y - old_rect.y;
-      dx = client_rect.x - constrained_rect.x;
-      dy = client_rect.y - constrained_rect.y;
-
-      if (deltax != dx || deltay != dy)
-        *result |= META_MOVE_RESIZE_RESULT_MOVED;
-
-      window->rect.x += (deltax - dx);
-      window->rect.y += (deltay - dy);
-
       *result |= META_MOVE_RESIZE_RESULT_RESIZED;
       meta_wayland_surface_configure_notify (window->surface,
                                              constrained_rect.width,
                                              constrained_rect.height);
     }
-  else
-    {
-      /* No resize happening, we can just move the window and live with it. */
-      if (window->rect.x != constrained_rect.x ||
-          window->rect.y != constrained_rect.y)
-        *result |= META_MOVE_RESIZE_RESULT_MOVED;
 
+  if (constrained_rect.x != window->rect.x ||
+      constrained_rect.y != window->rect.y)
+    {
+      *result |= META_MOVE_RESIZE_RESULT_MOVED;
       window->rect.x = constrained_rect.x;
       window->rect.y = constrained_rect.y;
     }


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