From e6558f838e3a27e47e0087b27435d782ff595c76 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 27 Jul 2014 17:47:40 +0200 Subject: [PATCH] window-wayland: Clean up code that pends moves --- src/wayland/window-wayland.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c index 31df759c6..fd807c0ad 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