layout: Add the ability to deactivate fullscreen surfaces 08/29608/1
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 23 Jan 2024 13:39:47 +0000 (15:39 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 24 Jan 2024 12:41:08 +0000 (14:41 +0200)
Deactivating fullscreen is a special case so we need to handle it
similarly to dialog/popups.

This adds an additional schedule for repaint in the fullscreen part to
force a redraw, otherwise deactivation/activation would need to inflict
any sort of damage to trigger a redraw.

Bug-AGL: SPEC-4348
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I258543f43514af07dfed7b36531816e90561cc61

src/layout.c

index c11dacb..4b8a691 100644 (file)
@@ -730,6 +730,7 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface)
                           ivi_layout_get_surface_role_name(surface),
                           output->name);
 
+               weston_compositor_schedule_repaint(ivi->compositor);
        }
 }
 
@@ -974,6 +975,32 @@ ivi_layout_popup_re_add(struct ivi_surface *surface)
        ivi_layout_popup_committed(surface);
 }
 
+static void
+ivi_layout_fullscreen_re_add(struct ivi_surface *surface)
+{
+       assert(surface->role == IVI_SURFACE_ROLE_FULLSCREEN);
+       struct weston_view *view = surface->view;
+
+       if (weston_view_is_mapped(view)) {
+               struct weston_desktop_surface *dsurface = surface->dsurface;
+               struct weston_surface *wsurface =
+                       weston_desktop_surface_get_surface(dsurface);
+
+               weston_layer_entry_remove(&view->layer_link);
+
+               wsurface->is_mapped = false;
+               view->is_mapped = false;
+       }
+
+       /* reset the activate by default in order to (still) allow the surface
+        * to be activaved using the request */
+       if (!surface->mapped)
+               surface->mapped = true;
+
+       surface->state = NORMAL;
+       ivi_layout_fullscreen_committed(surface);
+}
+
 static bool
 ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf)
 {
@@ -1027,6 +1054,11 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf)
                return;
        }
 
+       if (surf->role == IVI_SURFACE_ROLE_FULLSCREEN) {
+               ivi_layout_fullscreen_re_add(surf);
+               return;
+       }
+
        /* do not 're'-activate surfaces that are split or active */
        if (surf == output->active ||
            ivi_layout_surface_is_split_or_fullscreen(surf)) {
@@ -1177,7 +1209,8 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
                                weston_desktop_surface_get_app_id(dsurface);
                        ivi_layout_activate(ivi_output, previous_active_app_id);
                }
-       } else if (surf->role == IVI_SURFACE_ROLE_POPUP) {
+       } else if (surf->role == IVI_SURFACE_ROLE_POPUP ||
+                  surf->role == IVI_SURFACE_ROLE_FULLSCREEN) {
                struct weston_view *view  = surf->view;
 
                weston_view_unmap(view);
@@ -1188,5 +1221,5 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
                weston_surface_damage(view->surface);
        }
 
-      shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED);
+       shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED);
 }