summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2022-08-25 19:04:29 +0300
committerMarius Vlad <marius.vlad@collabora.com>2022-09-14 19:39:44 +0300
commitb92397ef12626a0d09cb4c9e853d0c038104110f (patch)
treef6fec7f5482a711ee2fd47bc9906f0a0cc1070d6
parent372eb222b17bbc9d40357187aa9700eddcd21f50 (diff)
shell: Remove the black curtain installed on outputs
Upon completion of activation we might have an output without a background surface set-up on that particular output, so this patch either uses the black curtain as a background surface (useful for transparent applications, which need it) or we remove it entirely in case the shell client has one installed. The patch renames the black_surface to black_curtain to better reflect its name. Also output filtering would need renaming (desktop_surface_check_last_surfaces) Bug-AGL: SPEC-4516 Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I6071b07664772d891a4d8c33a7603573ec2069fa
-rw-r--r--src/desktop.c13
-rw-r--r--src/ivi-compositor.h8
-rw-r--r--src/layout.c25
-rw-r--r--src/shell.c34
4 files changed, 60 insertions, 20 deletions
diff --git a/src/desktop.c b/src/desktop.c
index 1cda129..37f4222 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -242,13 +242,14 @@ desktop_surface_added(struct weston_desktop_surface *dsurface, void *userdata)
}
static bool
-desktop_surface_check_last_remote_surfaces(struct ivi_compositor *ivi, enum ivi_surface_role role)
+desktop_surface_check_last_surfaces(struct ivi_output *ivi_output, enum ivi_surface_role role)
{
int count = 0;
struct ivi_surface *surf;
- wl_list_for_each(surf, &ivi->surfaces, link)
- if (surf->role == role)
+ wl_list_for_each(surf, &ivi_output->ivi->surfaces, link)
+ if (surf->role == role &&
+ surf->current_completed_output == ivi_output)
count++;
return (count == 1);
@@ -327,10 +328,10 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
/* 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, IVI_SURFACE_ROLE_REMOTE) ||
- desktop_surface_check_last_remote_surfaces(output->ivi, IVI_SURFACE_ROLE_DESKTOP))
+ if (desktop_surface_check_last_surfaces(output, IVI_SURFACE_ROLE_REMOTE) ||
+ desktop_surface_check_last_surfaces(output, IVI_SURFACE_ROLE_DESKTOP))
if (!output->background)
- insert_black_surface(output);
+ insert_black_curtain(output);
if (weston_surface_is_mapped(wsurface)) {
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
index 7302348..bc5cc68 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
@@ -262,6 +262,7 @@ struct ivi_surface {
struct weston_desktop_surface *dsurface;
struct weston_view *view;
struct ivi_output *hidden_layer_output;
+ struct ivi_output *current_completed_output;
struct wl_list link;
int focus_count;
@@ -416,10 +417,13 @@ struct ivi_output *
ivi_layout_get_output_from_surface(struct ivi_surface *surf);
void
-insert_black_surface(struct ivi_output *output);
+insert_black_curtain(struct ivi_output *output);
void
-remove_black_surface(struct ivi_output *output);
+remove_black_curtain(struct ivi_output *output);
+
+bool
+output_has_black_curtain(struct ivi_output *output);
const char *
ivi_layout_get_surface_role_name(struct ivi_surface *surf);
diff --git a/src/layout.c b/src/layout.c
index 03ac814..031923a 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -201,6 +201,28 @@ ivi_layout_activate_complete(struct ivi_output *output,
weston_view_update_transform(view);
}
+ if (output_has_black_curtain(output)) {
+ if (!output->background) {
+ weston_log("Found that we have no background surface "
+ "for output %s. Using black curtain as background\n",
+ output->output->name);
+
+ struct weston_view *ev =
+ output->fullscreen_view.fs->view;
+
+ /* use the black curtain as background when we have
+ * none added by the shell client. */
+ weston_layer_entry_remove(&ev->layer_link);
+ weston_layer_entry_insert(&ivi->normal.view_list,
+ &ev->layer_link);
+ weston_view_geometry_dirty(ev);
+ weston_surface_damage(ev->surface);
+ } else {
+ remove_black_curtain(output);
+ }
+ }
+
+
weston_view_set_output(view, woutput);
weston_view_set_position(view,
woutput->x + output->area.x,
@@ -218,6 +240,7 @@ ivi_layout_activate_complete(struct ivi_output *output,
}
output->previous_active = output->active;
output->active = surf;
+ surf->current_completed_output = output;
weston_layer_entry_insert(&ivi->normal.view_list, &view->layer_link);
weston_view_geometry_dirty(view);
@@ -383,7 +406,7 @@ ivi_layout_desktop_committed(struct ivi_surface *surf)
if (r_output) {
struct weston_view *view = r_output->fullscreen_view.fs->view;
if (view->is_mapped || view->surface->is_mapped)
- remove_black_surface(r_output);
+ remove_black_curtain(r_output);
}
diff --git a/src/shell.c b/src/shell.c
index 28c1117..4ab5e42 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -47,7 +47,7 @@
#endif
static void
-create_black_surface_view(struct ivi_output *output);
+create_black_curtain_view(struct ivi_output *output);
void
agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi,
@@ -211,7 +211,7 @@ ivi_set_desktop_surface_remote(struct ivi_surface *surface)
* just being added */
view = output->fullscreen_view.fs->view;
if (view->is_mapped || view->surface->is_mapped)
- remove_black_surface(output);
+ remove_black_curtain(output);
if (output->type == OUTPUT_WALTHAM)
ivi_output_notify_waltham_plugin(surface);
@@ -708,8 +708,8 @@ ivi_shell_init_black_fs(struct ivi_compositor *ivi)
struct ivi_output *out;
wl_list_for_each(out, &ivi->outputs, link) {
- create_black_surface_view(out);
- insert_black_surface(out);
+ create_black_curtain_view(out);
+ insert_black_curtain(out);
}
}
@@ -908,7 +908,7 @@ ivi_launch_shell_client(struct ivi_compositor *ivi)
}
static void
-destroy_black_view(struct wl_listener *listener, void *data)
+destroy_black_curtain_view(struct wl_listener *listener, void *data)
{
struct fullscreen_view *fs =
wl_container_of(listener, fs, fs_destroy);
@@ -922,7 +922,7 @@ destroy_black_view(struct wl_listener *listener, void *data)
static void
-create_black_surface_view(struct ivi_output *output)
+create_black_curtain_view(struct ivi_output *output)
{
struct weston_surface *surface = NULL;
struct weston_view *view;
@@ -953,13 +953,21 @@ create_black_surface_view(struct ivi_output *output)
}
output->fullscreen_view.fs->view = view;
- output->fullscreen_view.fs_destroy.notify = destroy_black_view;
+ output->fullscreen_view.fs_destroy.notify = destroy_black_curtain_view;
wl_signal_add(&woutput->destroy_signal,
&output->fullscreen_view.fs_destroy);
}
+bool
+output_has_black_curtain(struct ivi_output *output)
+{
+ return (output->fullscreen_view.fs->view &&
+ output->fullscreen_view.fs->view->is_mapped &&
+ output->fullscreen_view.fs->view->surface->is_mapped);
+}
+
void
-remove_black_surface(struct ivi_output *output)
+remove_black_curtain(struct ivi_output *output)
{
struct weston_view *view;
@@ -981,10 +989,12 @@ remove_black_surface(struct ivi_output *output)
weston_view_update_transform(view);
weston_view_damage_below(view);
+
+ weston_log("Removed black curtain from output %s\n", output->output->name);
}
void
-insert_black_surface(struct ivi_output *output)
+insert_black_curtain(struct ivi_output *output)
{
struct weston_view *view;
@@ -1008,6 +1018,8 @@ insert_black_surface(struct ivi_output *output)
weston_view_update_transform(view);
weston_view_damage_below(view);
+
+ weston_log("Added black curtain to output %s\n", output->output->name);
}
static void
@@ -1035,7 +1047,7 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res)
wl_list_for_each(output, &ivi->outputs, link) {
if (output->background)
- remove_black_surface(output);
+ remove_black_curtain(output);
ivi_layout_init(ivi, output);
}
@@ -1399,7 +1411,7 @@ unbind_agl_shell(struct wl_resource *resource)
output->active = NULL;
}
- insert_black_surface(output);
+ insert_black_curtain(output);
}
wl_list_for_each_safe(surf, surf_tmp, &ivi->surfaces, link) {