1
0
Fork 0

window: Add proper interpretation of dx/dy

dx/dy should be against the regular window's rect, and need to
be ignored when we're resizing. Instead, we use gravity to anchor
the window's new rectangle when resizing.
This commit is contained in:
Jasper St. Pierre 2014-04-16 16:26:23 -04:00
parent 0797206cc2
commit c1f4352683
3 changed files with 13 additions and 15 deletions

View file

@ -415,12 +415,6 @@ struct _MetaWindow
*/ */
MetaRectangle rect; MetaRectangle rect;
/* The size and position we want the window to be (i.e. what we last asked
* the client to configure).
* This is only used for wayland clients.
*/
MetaRectangle expected_rect;
gboolean has_custom_frame_extents; gboolean has_custom_frame_extents;
GtkBorder custom_frame_extents; GtkBorder custom_frame_extents;

View file

@ -4405,14 +4405,23 @@ meta_window_move_resize_wayland (MetaWindow *window,
flags = META_IS_WAYLAND_RESIZE; flags = META_IS_WAYLAND_RESIZE;
meta_window_get_position (window, &x, &y); meta_window_get_position (window, &x, &y);
x += dx; y += dy;
if (x != window->expected_rect.x || y != window->expected_rect.y) /* dx/dy are ignored during resizing */
flags |= META_IS_MOVE_ACTION; if (!meta_grab_op_is_resizing (window->display->grab_op))
{
if (dx != 0 || dy != 0)
{
x += dx;
y += dy;
flags |= META_IS_MOVE_ACTION;
}
}
if (width != window->rect.width || height != window->rect.height) if (width != window->rect.width || height != window->rect.height)
flags |= META_IS_RESIZE_ACTION; flags |= META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window, flags, NorthWestGravity, meta_window_move_resize_internal (window, flags,
meta_resize_gravity_from_grab_op (window->display->grab_op),
x, y, width, height); x, y, width, height);
save_user_window_placement (window); save_user_window_placement (window);
} }

View file

@ -131,11 +131,6 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
* it can be for maximized or fullscreen. * it can be for maximized or fullscreen.
*/ */
/* First, save where we would like the client to be. This is used by the next
* attach to determine if the client is really moving/resizing or not.
*/
window->expected_rect = constrained_rect;
if (flags & META_IS_WAYLAND_RESIZE) if (flags & META_IS_WAYLAND_RESIZE)
{ {
/* This is a call to wl_surface_commit(), ignore the constrained_rect and /* This is a call to wl_surface_commit(), ignore the constrained_rect and