diff options
author | Rafal Mielniczuk <rafal.mielniczuk2@gmail.com> | 2013-03-11 19:26:56 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-03-19 14:07:57 -0400 |
commit | c1a3cd18513ec08942f68d29304fce197c7fccbf (patch) | |
tree | 6f6b35f1824f0805abb3a344ce34d21f08e8cf5b | |
parent | fc22be0bb9bdb2f8cca93f2cbe69b83b88bf3cdc (diff) |
window: restore maximized state from fullscreen mode if necessary
This patch sets back maximized mode, if that was its state before going
fullscreen.
-rw-r--r-- | clients/window.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clients/window.c b/clients/window.c index 3e8225f4..e3e8eb59 100644 --- a/clients/window.c +++ b/clients/window.c @@ -218,6 +218,7 @@ struct window { int redraw_needed; struct task redraw_task; int resize_needed; + int saved_type; int type; int focus_count; @@ -3398,6 +3399,7 @@ window_set_fullscreen(struct window *window, int fullscreen) return; if (fullscreen) { + window->saved_type = window->type; if (window->type == TYPE_TOPLEVEL) { window->saved_allocation = window->main_surface->allocation; } @@ -3406,11 +3408,16 @@ window_set_fullscreen(struct window *window, int fullscreen) window->fullscreen_method, 0, NULL); } else { - window->type = TYPE_TOPLEVEL; - wl_shell_surface_set_toplevel(window->shell_surface); - window_schedule_resize(window, - window->saved_allocation.width, - window->saved_allocation.height); + if (window->saved_type == TYPE_MAXIMIZED) { + window_set_maximized(window, 1); + } else { + window->type = TYPE_TOPLEVEL; + wl_shell_surface_set_toplevel(window->shell_surface); + window_schedule_resize(window, + window->saved_allocation.width, + window->saved_allocation.height); + } + } } @@ -3440,6 +3447,9 @@ window_set_maximized(struct window *window, int maximized) window->saved_allocation = window->main_surface->allocation; wl_shell_surface_set_maximized(window->shell_surface, NULL); window->type = TYPE_MAXIMIZED; + } else if (window->type == TYPE_FULLSCREEN) { + wl_shell_surface_set_maximized(window->shell_surface, NULL); + window->type = TYPE_MAXIMIZED; } else { wl_shell_surface_set_toplevel(window->shell_surface); window->type = TYPE_TOPLEVEL; |