[PATCH 4/4] window: restore maximized state from fullscreen mode if necessary
Rafal Mielniczuk
rafal.mielniczuk2 at gmail.com
Mon Mar 11 11:26:56 PDT 2013
This patch sets back maximized mode, if that was its state before going
fullscreen.
---
clients/window.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/clients/window.c b/clients/window.c
index 3e8225f..e3e8eb5 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;
--
1.8.1.5
More information about the wayland-devel
mailing list