src: Insert a black surface/remove it when the last remote 56/24656/2
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 29 May 2020 18:46:53 +0000 (21:46 +0300)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Sun, 14 Jun 2020 13:15:55 +0000 (13:15 +0000)
surface role is present

Bug-AGL: SPEC-3280

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ia47c0539ff26d1378bb9ac75e19592d7b8b2b3bf

src/desktop.c
src/ivi-compositor.h
src/shell.c

index b9e45da..b8b88db 100644 (file)
@@ -104,6 +104,19 @@ desktop_surface_added(struct weston_desktop_surface *dsurface, void *userdata)
        }
 }
 
+static bool
+desktop_surface_check_last_remote_surfaces(struct ivi_compositor *ivi)
+{
+       int count = 0;
+       struct ivi_surface *surf;
+
+       wl_list_for_each(surf, &ivi->surfaces, link)
+               if (surf->role == IVI_SURFACE_ROLE_REMOTE)
+                       count++;
+
+       return (count == 1);
+}
+
 static void
 desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
 {
@@ -133,6 +146,14 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
                weston_layer_entry_remove(&output->active->view->layer_link);
                output->active = NULL;
        }
+
+       /* check if there's a last 'remote' surface and insert a black
+        * surface view if there's no background set for that output
+        */
+       if (desktop_surface_check_last_remote_surfaces(output->ivi))
+               if (!output->background)
+                       insert_black_surface(output);
+
        if (weston_surface_is_mapped(wsurface)) {
                weston_desktop_surface_unlink_view(surface->view);
                weston_view_destroy(surface->view);
index e71b6d5..b3cc3af 100644 (file)
@@ -347,4 +347,10 @@ ivi_layout_desktop_resize(struct ivi_surface *surface,
 struct ivi_output *
 ivi_layout_get_output_from_surface(struct ivi_surface *surf);
 
+void
+insert_black_surface(struct ivi_output *output);
+
+void
+remove_black_surface(struct ivi_output *output);
+
 #endif
index 37ceb25..e1aac8d 100644 (file)
@@ -45,9 +45,6 @@
 static void
 create_black_surface_view(struct ivi_output *output);
 
-static void
-insert_black_surface(struct ivi_output *output);
-
 void
 ivi_set_desktop_surface(struct ivi_surface *surface)
 {
@@ -90,11 +87,22 @@ static void
 ivi_set_desktop_surface_remote(struct ivi_surface *surface)
 {
        struct ivi_compositor *ivi = surface->ivi;
+       struct weston_view *view;
+       struct ivi_output *output = surface->remote.output;
+
        assert(surface->role == IVI_SURFACE_ROLE_NONE);
 
        /* remote type are the same as desktop just that client can tell
         * the compositor to start on another output */
        surface->role = IVI_SURFACE_ROLE_REMOTE;
+
+       /* if thew black surface view is mapped on the mean we need
+        * to remove it in order to start showing the 'remote' surface
+        * just being added */
+       view = output->fullscreen_view.fs->view;
+       if (view->is_mapped || view->surface->is_mapped)
+               remove_black_surface(output);
+
        wl_list_insert(&ivi->surfaces, &surface->link);
 }
 
@@ -548,7 +556,7 @@ create_black_surface_view(struct ivi_output *output)
                      &output->fullscreen_view.fs_destroy);
 }
 
-static void
+void
 remove_black_surface(struct ivi_output *output)
 {
        struct weston_view *view = output->fullscreen_view.fs->view;
@@ -565,7 +573,7 @@ remove_black_surface(struct ivi_output *output)
        weston_output_damage(output->output);
 }
 
-static void
+void
 insert_black_surface(struct ivi_output *output)
 {
        struct weston_view *view = output->fullscreen_view.fs->view;