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
This commit is contained in:
Florian Müllner 2011-12-05 21:52:46 +01:00
parent 4ca552785f
commit bed9cb1648
2 changed files with 9 additions and 0 deletions

View File

@ -129,6 +129,9 @@ struct _MetaWindow
* this is the current mode. If not, it is the mode which will be * this is the current mode. If not, it is the mode which will be
* requested after the window grab is released */ * requested after the window grab is released */
guint tile_mode : 2; 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; int tile_monitor_number;
/* Whether we're shaded */ /* Whether we're shaded */

View File

@ -3419,6 +3419,9 @@ meta_window_maximize_internal (MetaWindow *window,
else else
meta_window_save_rect (window); meta_window_save_rect (window);
if (maximize_horizontally && maximize_vertically)
window->saved_maximize = TRUE;
window->maximized_horizontally = window->maximized_horizontally =
window->maximized_horizontally || maximize_horizontally; window->maximized_horizontally || maximize_horizontally;
window->maximized_vertically = window->maximized_vertically =
@ -3685,6 +3688,9 @@ meta_window_unmaximize_internal (MetaWindow *window,
unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL; unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL;
g_assert (unmaximize_horizontally || unmaximize_vertically); 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 /* Only do something if the window isn't already maximized in the
* given direction(s). * given direction(s).
*/ */