window: Add meta_window_untile()

It does the same as the untile keyboard shortcut does, i.e. handles
going back to saved maximized state. It's split out to be able to be
tested by the stacking tests.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171
This commit is contained in:
Jonas Ådahl 2020-04-02 19:04:43 +02:00 committed by Georges Basile Stavracas Neto
parent 449cbe153b
commit 668eb318c7
3 changed files with 20 additions and 9 deletions

View File

@ -3302,15 +3302,7 @@ handle_toggle_tiled (MetaDisplay *display,
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) || if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT)) (META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{ {
window->tile_monitor_number = window->saved_maximize ? window->monitor->number meta_window_untile (window);
: -1;
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
} }
else if (meta_window_can_tile_side_by_side (window)) else if (meta_window_can_tile_side_by_side (window))
{ {

View File

@ -646,6 +646,9 @@ void meta_window_unmanage (MetaWindow *window,
void meta_window_unmanage_on_idle (MetaWindow *window); void meta_window_unmanage_on_idle (MetaWindow *window);
void meta_window_queue (MetaWindow *window, void meta_window_queue (MetaWindow *window,
guint queuebits); guint queuebits);
META_EXPORT_TEST
void meta_window_untile (MetaWindow *window);
META_EXPORT_TEST META_EXPORT_TEST
void meta_window_tile (MetaWindow *window, void meta_window_tile (MetaWindow *window,
MetaTileMode mode); MetaTileMode mode);

View File

@ -3124,6 +3124,22 @@ update_edge_constraints (MetaWindow *window)
} }
} }
void
meta_window_untile (MetaWindow *window)
{
window->tile_monitor_number =
window->saved_maximize ? window->monitor->number
: -1;
window->tile_mode =
window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
void void
meta_window_tile (MetaWindow *window, meta_window_tile (MetaWindow *window,
MetaTileMode tile_mode) MetaTileMode tile_mode)