From bed9cb164834179527a28f4a129a4bc83b05f041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 5 Dec 2011 21:52:46 +0100 Subject: [PATCH] window: Keep track of the last full-maximization state In order to be able to toggle between tiled and normal/maximized states, we need to keep track of the last full maximization state. https://bugzilla.gnome.org/show_bug.cgi?id=648700 --- src/core/window-private.h | 3 +++ src/core/window.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/core/window-private.h b/src/core/window-private.h index 55afdde16..b05087b44 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -129,6 +129,9 @@ struct _MetaWindow * 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; + /* The last "full" maximized/unmaximized state. We need to keep track of + * that to toggle between normal/tiled or maximized/tiled states. */ + guint saved_maximize : 1; int tile_monitor_number; /* Whether we're shaded */ diff --git a/src/core/window.c b/src/core/window.c index 40365d967..488a80a85 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3419,6 +3419,9 @@ meta_window_maximize_internal (MetaWindow *window, else meta_window_save_rect (window); + if (maximize_horizontally && maximize_vertically) + window->saved_maximize = TRUE; + window->maximized_horizontally = window->maximized_horizontally || maximize_horizontally; window->maximized_vertically = @@ -3685,6 +3688,9 @@ meta_window_unmaximize_internal (MetaWindow *window, unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL; g_assert (unmaximize_horizontally || unmaximize_vertically); + if (unmaximize_horizontally && unmaximize_vertically) + window->saved_maximize = FALSE; + /* Only do something if the window isn't already maximized in the * given direction(s). */