summaryrefslogtreecommitdiff
path: root/src/core/constraints.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2017-08-29 15:36:19 -0400
committerVictor Kareh <[email protected]>2017-08-29 15:36:19 -0400
commitc577f51e1e1258f8a6c55764a8b86d3421c466e7 (patch)
treedffc4a03b5344df3724bc246d34a7694fe59d67c /src/core/constraints.c
parenta5439d2175395763e06e8bec10ad7b914742882a (diff)
downloadmarco-c577f51e1e1258f8a6c55764a8b86d3421c466e7.tar.bz2
marco-c577f51e1e1258f8a6c55764a8b86d3421c466e7.tar.xz
Allow tiled windows to be resized horizontally
Determine whether the user is initiating a resize action on a tiled window. If the user is trying to grab the window for resizing horizontally from the edge that's farther away from the screen edge, allow the resize to occur. Otherwise maintain the current tile geometry. Also modified the window hints to allow resizing from the window menu. Fixes #250
Diffstat (limited to 'src/core/constraints.c')
-rw-r--r--src/core/constraints.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 69263a51..783449d3 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -876,6 +876,7 @@ constrain_tiling (MetaWindow *window,
gboolean hminbad, vminbad;
gboolean horiz_equal, vert_equal;
gboolean constraint_already_satisfied;
+ gboolean allow_resize = FALSE;
if (priority > PRIORITY_TILING)
return TRUE;
@@ -908,9 +909,37 @@ constrain_tiling (MetaWindow *window,
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
+ /* Allow the user to resize horizontally when tiled */
+ if (info->is_user_action)
+ {
+ /* Only allow resizing from the window side farther from the screen edge */
+ switch (info->resize_gravity)
+ {
+ case NorthEastGravity:
+ case EastGravity:
+ case SouthEastGravity:
+ if (window->tile_mode == META_TILE_RIGHT)
+ allow_resize = TRUE;
+ break;
+ case NorthWestGravity:
+ case WestGravity:
+ case SouthWestGravity:
+ if (window->tile_mode == META_TILE_LEFT)
+ allow_resize = TRUE;
+ break;
+ }
+
+ /* Maintain current tile size for all other user-initiated alternatives */
+ target_size.x = info->orig.x;
+ target_size.width = info->orig.width;
+ }
+
/*** Enforce constraint ***/
- info->current.x = target_size.x;
- info->current.width = target_size.width;
+ if (!allow_resize)
+ {
+ info->current.x = target_size.x;
+ info->current.width = target_size.width;
+ }
info->current.y = target_size.y;
info->current.height = target_size.height;