shell: fix various interactions with the minimized state 56/31656/1 accepted/tizen/common/20141208.181539 submit/tizen_common/20141208.130526
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Mon, 8 Dec 2014 12:39:17 +0000 (13:39 +0100)
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Mon, 8 Dec 2014 12:39:17 +0000 (13:39 +0100)
This fixes the following :
- if a surface was set fullscreen, and then minimized,
the fullscreen compositor state would stay on and display
a black screen ;
- if a surface was set fullscreen, and we would then
cycle between surfaces (with Mod+Tab e.g.), the fullscreen
compositor state would stay on, and the fullscreen layer
would sometimes hide surfaces positioned behind it ;
- style and functional polishing.

Change-Id: Ieeec480d16769f27d2ed7a97eb943e0100efcd0b
Bug-Tizen: TC-1349
Origin: http://lists.freedesktop.org/archives/wayland-devel/2014-July/016257.html
Author: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Author: Nicolas Guyomard <nicolas.guyomard@open.eurogiciel.org>
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
desktop-shell/shell.c

index 8f7457f..2ee9f51 100644 (file)
@@ -2610,6 +2610,7 @@ set_minimized(struct weston_surface *surface, uint32_t is_true)
        struct weston_seat *seat;
        struct weston_surface *focus;
        struct weston_view *view;
+       float x, y;
 
        view = get_default_view(surface);
        if (!view)
@@ -2623,6 +2624,17 @@ set_minimized(struct weston_surface *surface, uint32_t is_true)
        weston_layer_entry_remove(&view->layer_link);
         /* hide or show, depending on the state */
        if (is_true) {
+                /* if the surface is fullscreen, unset the global fullscreen state,
+                 * but keep the surface centered on its previous output.
+                 */
+               if (shsurf->state.fullscreen) {
+                       x = shsurf->view->geometry.x;
+                       y = shsurf->view->geometry.y;
+                       unset_fullscreen(shsurf);
+                       weston_view_set_position(shsurf->view, x, y);
+               }
+
+               weston_layer_entry_remove(&view->layer_link);
                weston_layer_entry_insert(&shsurf->shell->minimized_layer.view_list, &view->layer_link);
 
                drop_focus_state(shsurf->shell, current_ws, view->surface);
@@ -5770,11 +5782,23 @@ struct switcher {
 static void
 switcher_next(struct switcher *switcher)
 {
+       struct focus_state *state;
+       struct weston_surface *surface;
        struct weston_view *view;
        struct weston_surface *first = NULL, *prev = NULL, *next = NULL;
        struct shell_surface *shsurf;
        struct workspace *ws = get_current_workspace(switcher->shell);
 
+        /* if the focused surface is fullscreen, minimize it */
+       wl_list_for_each(state, &ws->focus_list, link) {
+               if (state->keyboard_focus) {
+                       surface = weston_surface_get_main_surface(state->keyboard_focus);
+                       shsurf = get_shell_surface(surface);
+                       if (shsurf->state.fullscreen)
+                               set_minimized(surface, 1);
+               }
+       }
+
         /* temporary re-display minimized surfaces */
        struct weston_view *tmp;
        struct weston_view **minimized;
@@ -5821,7 +5845,8 @@ switcher_next(struct switcher *switcher)
                view->alpha = 1.0;
 
        shsurf = get_shell_surface(switcher->current);
-       if (shsurf && shsurf->state.fullscreen)
+       if (shsurf && shsurf->state.fullscreen
+                  && shsurf->fullscreen.black_view)
                shsurf->fullscreen.black_view->alpha = 1.0;
 }