From c5abf5ddbb4242dd9d37354b8de44c01b5b482f9 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 14 Jul 2014 17:00:01 -0400 Subject: [PATCH] window: Fix meta_window_move_resize_internal for the case of a sole ack When a Wayland window acks our arrangement and we don't really have anything to modify, we'll pass a sole flag of META_IS_WAYLAND_RESIZE to meta_window_move_resize_internal using a garbage rect. The existing code to calculate the new rectangle couldn't really handle this case, and so the garbage rectangle accidentally got stored. Revamp the flag checks to be more clear about it. This fixes the weird positioning issues that sometimes appear when resizing weston-terminal among others. --- src/core/window.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index ee1614e8a..ac4097944 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3674,29 +3674,40 @@ meta_window_move_resize_internal (MetaWindow *window, /* We don't need it in the idle queue anymore. */ meta_window_unqueue (window, META_QUEUE_MOVE_RESIZE); - /* If this is only a resize, then ignore the position given in - * the parameters and instead calculate the new position from - * resizing the old rectangle with the given gravity. */ - if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_RESIZE_ACTION) + if ((flags & META_IS_RESIZE_ACTION) && (flags & META_IS_MOVE_ACTION)) { + /* We're both moving and resizing. Just use the passed in rect. */ + unconstrained_rect = frame_rect; + } + else if ((flags & META_IS_RESIZE_ACTION)) + { + /* If this is only a resize, then ignore the position given in + * the parameters and instead calculate the new position from + * resizing the old rectangle with the given gravity. */ meta_rectangle_resize_with_gravity (&window->rect, &unconstrained_rect, gravity, frame_rect.width, frame_rect.height); } - else - { - unconstrained_rect = frame_rect; - } - - /* If this is only a move, then ignore the passed in size and - * just use the existing size of the window. */ - if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_MOVE_ACTION) + else if ((flags & META_IS_MOVE_ACTION)) { + /* If this is only a move, then ignore the passed in size and + * just use the existing size of the window. */ + unconstrained_rect.x = frame_rect.x; + unconstrained_rect.y = frame_rect.y; unconstrained_rect.width = window->rect.width; unconstrained_rect.height = window->rect.height; } + else if ((flags & META_IS_WAYLAND_RESIZE)) + { + /* This is a Wayland buffer acking our size. The new rect is + * just the existing one we have. Ignore the passed-in rect + * completely. */ + unconstrained_rect = window->rect; + } + else + g_assert_not_reached (); constrained_rect = unconstrained_rect; if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))