From a87157176ca6e01c8c4047999ee584f00b63c11e Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Fri, 31 May 2013 16:22:39 +0200 Subject: Implement side-by-side tiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Florian Müllner for Metacity https://bugzilla.gnome.org/show_bug.cgi?id=607694 When dragging a window over a screen edge and dropping it there, maximize it vertically and scale it horizontally to cover the corresponding half of the current monitor. Whenever a "hot area" which triggers this behavior is entered, an indication of window's target size is displayed after a short delay to avoid distraction when moving a window between monitors. --- src/core/window-private.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/core/window-private.h') diff --git a/src/core/window-private.h b/src/core/window-private.h index 447a2c4b..02c518e0 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -83,6 +83,12 @@ typedef enum { #define NUMBER_OF_QUEUES 3 +typedef enum { + META_TILE_NONE, + META_TILE_LEFT, + META_TILE_RIGHT +} MetaTileMode; + struct _MetaWindow { MetaDisplay *display; @@ -138,6 +144,11 @@ struct _MetaWindow guint maximize_vertically_after_placement : 1; guint minimize_after_placement : 1; + /* The current or requested tile mode. If maximized_vertically is true, + * this is the current mode. If not, it is the mode which will be + * requested after the window grab is released */ + guint tile_mode : 2; + /* Whether we're shaded */ guint shaded : 1; @@ -383,8 +394,11 @@ struct _MetaWindow (w)->maximized_vertically) #define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically) #define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally) +#define META_WINDOW_TILED(w) ((w)->maximized_vertically && \ + !(w)->maximized_horizontally && \ + (w)->tile_mode != META_TILE_NONE) #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) && !(w)->fullscreen && !(w)->shaded) +#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(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))) @@ -575,6 +589,8 @@ void meta_window_get_work_area_for_xinerama (MetaWindow *window, void meta_window_get_work_area_all_xineramas (MetaWindow *window, MetaRectangle *area); +void meta_window_get_current_tile_area (MetaWindow *window, + MetaRectangle *tile_area); gboolean meta_window_same_application (MetaWindow *window, MetaWindow *other_window); -- cgit v1.2.1