[mutter] window-wayland: Clean up code that pends moves



commit e6558f838e3a27e47e0087b27435d782ff595c76
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Jul 27 17:47:40 2014 +0200

    window-wayland: Clean up code that pends moves

 src/wayland/window-wayland.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 31df759..fd807c0 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -160,7 +160,7 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
                                           MetaMoveResizeResultFlags *result)
 {
   MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
-  gboolean should_move = FALSE;
+  gboolean can_move_now;
 
   g_assert (window->frame == NULL);
 
@@ -201,16 +201,12 @@ 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;
+      can_move_now = TRUE;
     }
 
   if (constrained_rect.width != window->rect.width ||
       constrained_rect.height != window->rect.height)
     {
-      wl_window->has_pending_move = TRUE;
-      wl_window->pending_move_x = constrained_rect.x;
-      wl_window->pending_move_y = constrained_rect.y;
-
       wl_window->last_sent_width = constrained_rect.width;
       wl_window->last_sent_height = constrained_rect.height;
 
@@ -218,15 +214,18 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
                                              constrained_rect.width,
                                              constrained_rect.height,
                                              &wl_window->pending_configure_serial);
+
+      /* We need to wait until the resize completes before we can move */
+      can_move_now = FALSE;
     }
   else
     {
       /* We're just moving the window, so we don't need to wait for a configure
        * and then ack to simply move the window. */
-      should_move = TRUE;
+      can_move_now = TRUE;
     }
 
-  if (should_move)
+  if (can_move_now)
     {
       int new_x = constrained_rect.x;
       int new_y = constrained_rect.y;
@@ -248,6 +247,18 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
           window->buffer_rect.y = new_buffer_y;
         }
     }
+  else
+    {
+      int new_x = constrained_rect.x;
+      int new_y = constrained_rect.y;
+
+      if (new_x != window->rect.x || new_y != window->rect.y)
+        {
+          wl_window->has_pending_move = TRUE;
+          wl_window->pending_move_x = new_x;
+          wl_window->pending_move_y = new_y;
+        }
+    }
 }
 
 static void


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