Skip to content

Commit 5d3121e

Browse files
authored
constraints: Allow resize of windows moved above screen (#696)
If the titlebar of a window has been moved above the screen by a user via an unconstrained move, then any constrained user resize following this move will cause the window to jump below the top of the screen or cause other glitchy behavior. This commit removes the constraint that the titlebar of a window must be below the top of the screen for any resize that is both (1) triggered by a user and (2) is a resize that affects only the left, right, or bottom edges of the window. This allows users to move a window partially above the screen and then resize the window to be wider or resize the bottom edge of the window to make it taller or shorter. This is a backport of 5ba364a9476905d9b92e7dc6cdc2f273bcda2498.
1 parent ea89926 commit 5d3121e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/core/constraints.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,7 @@ constrain_titlebar_visible (MetaWindow *window,
17201720
gboolean check_only)
17211721
{
17221722
gboolean unconstrained_user_action;
1723+
gboolean user_nonnorthern_resize;
17231724
gboolean retval;
17241725
int bottom_amount;
17251726
int horiz_amount_offscreen, vert_amount_offscreen;
@@ -1734,6 +1735,18 @@ constrain_titlebar_visible (MetaWindow *window,
17341735
unconstrained_user_action =
17351736
info->is_user_action && !window->display->grab_frame_action;
17361737

1738+
/* If the user is resizing anything other than the top, then don't check if
1739+
* the titlebar is beyond the top of the screen. This resize might be
1740+
* immediately following an unconstrained move or unconstrained resize that
1741+
* placed the titlebar above the top of the screen, in which case we don't
1742+
* want the titlebar immediately popping back below the screen or other
1743+
* glitching (https://gitlab.gnome.org/GNOME/mutter/-/issues/1206).
1744+
*/
1745+
user_nonnorthern_resize =
1746+
info->is_user_action &&
1747+
meta_grab_op_is_resizing (window->display->grab_op) &&
1748+
info->orig.y == info->current.y;
1749+
17371750
/* Exit early if we know the constraint won't apply--note that this constraint
17381751
* is only meant for normal windows (e.g. we don't want docks to be shoved
17391752
* "onscreen" by their own strut).
@@ -1743,6 +1756,7 @@ constrain_titlebar_visible (MetaWindow *window,
17431756
window->fullscreen ||
17441757
!window->require_titlebar_visible ||
17451758
unconstrained_user_action ||
1759+
user_nonnorthern_resize ||
17461760
meta_window_get_placement_rule (window))
17471761
return TRUE;
17481762

0 commit comments

Comments
 (0)