From 4ccf24665bfb3501e727f133a5f7c59ade2154d2 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Thu, 27 May 2021 07:16:39 -0400 Subject: window: Track window rectangle before corner tiling When corner-tiling a maximized window, we should keep track of the saved rectangle so that tiling does not reset our window size. Otherwise, untiling the previously maximized window will end up with an unmaximized full-size window, rather than the original window size. --- src/core/window.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/window.c b/src/core/window.c index c7bad1af..68ac89ab 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2497,8 +2497,10 @@ ensure_size_hints_satisfied (MetaRectangle *rect, static void meta_window_save_rect (MetaWindow *window) { - if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_SIDE_TILED (window) || - META_WINDOW_CORNER_TILED(window) || window->fullscreen)) + if (!(META_WINDOW_MAXIMIZED (window) || + META_WINDOW_SIDE_TILED (window) || + META_WINDOW_CORNER_TILED(window) || + window->fullscreen)) { /* save size/pos as appropriate args for move_resize */ if (!window->maximized_horizontally) @@ -2698,14 +2700,24 @@ meta_window_tile (MetaWindow *window) if (window->tile_mode == META_TILE_NONE) return; - if(window->tile_mode == META_TILE_LEFT || window->tile_mode == META_TILE_RIGHT) + if (window->tile_mode == META_TILE_LEFT || + window->tile_mode == META_TILE_RIGHT) { MetaRectangle *saved_rect = NULL; saved_rect = &window->saved_rect; meta_window_maximize_internal (window, META_MAXIMIZE_VERTICAL, saved_rect); } + else if (window->tile_mode == META_TILE_BOTTOM_RIGHT || + window->tile_mode == META_TILE_BOTTOM_LEFT || + window->tile_mode == META_TILE_TOP_RIGHT || + window->tile_mode == META_TILE_TOP_LEFT) + { + MetaRectangle *saved_rect = NULL; + saved_rect = &window->saved_rect; + meta_window_maximize_internal (window, META_MAXIMIZE_HORIZONTAL, saved_rect); + } else - meta_window_save_rect(window); + meta_window_save_rect (window); window->tiled = TRUE; /* move_resize with new tiling constraints -- cgit v1.2.1