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.
This commit is contained in:
Jasper St. Pierre 2014-07-14 17:00:01 -04:00
parent 2a3d4b62a7
commit c5abf5ddbb

View File

@ -3674,29 +3674,40 @@ meta_window_move_resize_internal (MetaWindow *window,
/* We don't need it in the idle queue anymore. */ /* We don't need it in the idle queue anymore. */
meta_window_unqueue (window, META_QUEUE_MOVE_RESIZE); meta_window_unqueue (window, META_QUEUE_MOVE_RESIZE);
/* If this is only a resize, then ignore the position given in if ((flags & META_IS_RESIZE_ACTION) && (flags & META_IS_MOVE_ACTION))
* 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)
{ {
/* 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, meta_rectangle_resize_with_gravity (&window->rect,
&unconstrained_rect, &unconstrained_rect,
gravity, gravity,
frame_rect.width, frame_rect.width,
frame_rect.height); frame_rect.height);
} }
else else if ((flags & META_IS_MOVE_ACTION))
{
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)
{ {
/* 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.width = window->rect.width;
unconstrained_rect.height = window->rect.height; 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; constrained_rect = unconstrained_rect;
if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))