diff options
-rw-r--r-- | src/core/constraints.c | 33 | ||||
-rw-r--r-- | src/core/window-private.h | 4 |
2 files changed, 33 insertions, 4 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; diff --git a/src/core/window-private.h b/src/core/window-private.h index b3871bb8..e449b172 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -408,12 +408,12 @@ struct _MetaWindow #define META_WINDOW_TILED_RIGHT(w) (META_WINDOW_TILED(w) && \ (w)->tile_mode == META_TILE_RIGHT) #define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen) -#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !META_WINDOW_TILED(w) && !(w)->fullscreen && !(w)->shaded) +#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded) #define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \ (((w)->size_hints.min_width < (w)->size_hints.max_width) || \ ((w)->size_hints.min_height < (w)->size_hints.max_height))) #define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width) -#define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height) +#define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && !META_WINDOW_TILED(w) && (w)->size_hints.min_height < (w)->size_hints.max_height) MetaWindow* meta_window_new (MetaDisplay *display, Window xwindow, |