window: restore maximized state from fullscreen mode if necessary

This patch sets back maximized mode, if that was its state before going
fullscreen.
This commit is contained in:
Rafal Mielniczuk
2013-03-11 19:26:56 +01:00
committed by Kristian Høgsberg
parent fc22be0bb9
commit c1a3cd1851
+15 -5
View File
@@ -218,6 +218,7 @@ struct window {
int redraw_needed; int redraw_needed;
struct task redraw_task; struct task redraw_task;
int resize_needed; int resize_needed;
int saved_type;
int type; int type;
int focus_count; int focus_count;
@@ -3398,6 +3399,7 @@ window_set_fullscreen(struct window *window, int fullscreen)
return; return;
if (fullscreen) { if (fullscreen) {
window->saved_type = window->type;
if (window->type == TYPE_TOPLEVEL) { if (window->type == TYPE_TOPLEVEL) {
window->saved_allocation = window->main_surface->allocation; window->saved_allocation = window->main_surface->allocation;
} }
@@ -3406,11 +3408,16 @@ window_set_fullscreen(struct window *window, int fullscreen)
window->fullscreen_method, window->fullscreen_method,
0, NULL); 0, NULL);
} else { } else {
window->type = TYPE_TOPLEVEL; if (window->saved_type == TYPE_MAXIMIZED) {
wl_shell_surface_set_toplevel(window->shell_surface); window_set_maximized(window, 1);
window_schedule_resize(window, } else {
window->saved_allocation.width, window->type = TYPE_TOPLEVEL;
window->saved_allocation.height); 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; window->saved_allocation = window->main_surface->allocation;
wl_shell_surface_set_maximized(window->shell_surface, NULL); wl_shell_surface_set_maximized(window->shell_surface, NULL);
window->type = TYPE_MAXIMIZED; window->type = TYPE_MAXIMIZED;
} else if (window->type == TYPE_FULLSCREEN) {
wl_shell_surface_set_maximized(window->shell_surface, NULL);
window->type = TYPE_MAXIMIZED;
} else { } else {
wl_shell_surface_set_toplevel(window->shell_surface); wl_shell_surface_set_toplevel(window->shell_surface);
window->type = TYPE_TOPLEVEL; window->type = TYPE_TOPLEVEL;