summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2020-10-14 10:30:53 +0200
committerRobert Mader <robert.mader@posteo.de>2020-10-19 21:36:48 +0200
commit54936263cdfda48b5bf38d79b6f218d59e2c7f07 (patch)
treeca23a7ca0f4cb954c8b1829e56393623a0ff6862
parente28c1ab4ae7edd8913e788a37f5f58b9338fc67d (diff)
downloadmutter-54936263cdfda48b5bf38d79b6f218d59e2c7f07.tar.gz
constraints: Use "orig" rectangle for interactive resize
Bug 448183 fixed an issue with _NET_WM_MOVERESIZE_WINDOW not moving a window by basing the resize on the current (new) rectangle instead of the original rectangle. While this fixes the issue with _NET_WM_MOVERESIZE_WINDOW, this also causes windows with a size increment to move when the resize also implies a move, such windows might drift while resizing. Make sure to use the current rectangle for non-interactive resizes only. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/543 (cherry picked from commit 7ab3eac0e27e62642bdd8dc1ddad3bf9acf5a02d)
-rw-r--r--src/core/constraints.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 168a55b8a..90e9a035a 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -469,6 +469,16 @@ setup_constraint_info (ConstraintInfo *info,
info->entire_monitor.width, info->entire_monitor.height);
}
+static MetaRectangle *
+get_start_rect_for_resize (MetaWindow *window,
+ ConstraintInfo *info)
+{
+ if (!info->is_user_action && info->action_type == ACTION_MOVE_AND_RESIZE)
+ return &info->current;
+ else
+ return &info->orig;
+}
+
static void
place_window_if_needed(MetaWindow *window,
ConstraintInfo *info)
@@ -1368,13 +1378,7 @@ constrain_size_increments (MetaWindow *window,
new_height = client_rect.height;
}
- /* Figure out what original rect to pass to meta_rectangle_resize_with_gravity
- * See bug 448183
- */
- if (info->action_type == ACTION_MOVE_AND_RESIZE)
- start_rect = &info->current;
- else
- start_rect = &info->orig;
+ start_rect = get_start_rect_for_resize (window, info);
/* Resize to the new size */
meta_rectangle_resize_with_gravity (start_rect,
@@ -1424,13 +1428,7 @@ constrain_size_limits (MetaWindow *window,
new_width = CLAMP (info->current.width, min_size.width, max_size.width);
new_height = CLAMP (info->current.height, min_size.height, max_size.height);
- /* Figure out what original rect to pass to meta_rectangle_resize_with_gravity
- * See bug 448183
- */
- if (info->action_type == ACTION_MOVE_AND_RESIZE)
- start_rect = &info->current;
- else
- start_rect = &info->orig;
+ start_rect = get_start_rect_for_resize (window, info);
meta_rectangle_resize_with_gravity (start_rect,
&info->current,
@@ -1570,13 +1568,7 @@ constrain_aspect_ratio (MetaWindow *window,
new_height = client_rect.height;
}
- /* Figure out what original rect to pass to meta_rectangle_resize_with_gravity
- * See bug 448183
- */
- if (info->action_type == ACTION_MOVE_AND_RESIZE)
- start_rect = &info->current;
- else
- start_rect = &info->orig;
+ start_rect = get_start_rect_for_resize (window, info);
meta_rectangle_resize_with_gravity (start_rect,
&info->current,