summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2024-12-13 15:37:08 +0200
committerMarius Vlad <marius.vlad@collabora.com>2024-12-17 14:43:17 +0200
commit87e4a88fee16ffaa3bd65082710db6916c70658e (patch)
tree534cdac20050f7bbf715d5a3ed68c3f316e8e890
parenta10caffaf892b4c05231eed11eefa9e1f7cd5e39 (diff)
layout: Add a background for remote outputssandbox/mvlad/updates-pipewire
Shell client might not install a background for the remote outputs so let's create one if we detect that. It will be just a black background. As shell client might not install a background, wayland clients can have an alpha channel and might need to have a background underneath, or the application streamed on that remote output might be closed/removed but we will still continue to display the last frame updated. This includes also a correction to check for an app_id. Bug-AGL: SPEC-5324 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Iad1ceaae2ead62f1809cf2f0a58302474ff488d0
-rw-r--r--src/compositor.c8
-rw-r--r--src/desktop.c9
-rw-r--r--src/layout.c52
3 files changed, 63 insertions, 6 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 36a12d4..207dbf2 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -307,6 +307,14 @@ ivi_ensure_output(struct ivi_compositor *ivi, struct ivi_backend *ivi_backend,
}
}
+ switch (weston_get_backend_type(ivi_backend->backend)) {
+ case WESTON_BACKEND_VNC:
+ case WESTON_BACKEND_RDP:
+ case WESTON_BACKEND_PIPEWIRE:
+ output->type = OUTPUT_REMOTE;
+ break;
+ default:
+ }
wl_list_insert(&ivi->outputs, &output->link);
ivi_output_configure_app_id(output);
diff --git a/src/desktop.c b/src/desktop.c
index b327fe6..5ec1e36 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -285,8 +285,9 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
* the DESKTOP role can happen here as well, because we can fall-back
* to that when we try to determine the role type. Application that
* do not set the app_id will be land here, when destroyed */
- if ((output == NULL && (surface->role == IVI_SURFACE_ROLE_NONE ||
- surface->role == IVI_SURFACE_ROLE_DESKTOP)) ||
+ if ((output == NULL &&
+ (surface->role == IVI_SURFACE_ROLE_NONE ||
+ surface->role == IVI_SURFACE_ROLE_DESKTOP)) ||
output->output == NULL)
goto skip_output_asignment;
@@ -333,8 +334,8 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
if (surface->role == IVI_SURFACE_ROLE_TILE) {
ivi_layout_reset_split_surfaces(surface->ivi);
- // activate previous when resizing back to give input set
- // output active for allowing to resizing again if needed
+ /* activate previous when resizing back to give input set
+ * output active for allowing to resizing again if needed */
if (output->previous_active)
ivi_layout_activate_by_surf(output, output->previous_active);
}
diff --git a/src/layout.c b/src/layout.c
index 6c1df75..45c5507 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -33,6 +33,7 @@
#include <libweston/config-parser.h>
#include <libweston/libweston.h>
#include <libweston/desktop.h>
+#include <libweston/shell-utils.h>
#define AGL_COMP_DEBUG
@@ -136,6 +137,12 @@ ivi_layout_get_surface_role_name(struct ivi_surface *surf)
return ivi_roles_as_string[surf->role];
}
+static int
+black_surface_get_label(struct weston_surface *surface, char *buf, size_t len)
+{
+ return snprintf(buf, len, "remote output background surface");
+}
+
static void
ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output)
{
@@ -145,7 +152,48 @@ ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output)
struct weston_surface *wsurface;
if (!bg) {
- weston_log("WARNING: Output does not have a background\n");
+ struct weston_curtain *curtain = NULL;
+ struct ivi_surface *ivi_surf = NULL;
+
+ weston_log("WARNING: Output %s (type: %d) does not have a background.\n", output->output->name, output->type);
+ if (output->type != OUTPUT_REMOTE)
+ return;
+
+ weston_log("Installing a red background on output %s.\n",
+ output->output->name);
+
+ struct weston_curtain_params curtain_params = {
+ .r = 1.0, .g = 0.0, .b = 0.0, .a = 1.0,
+ .pos = woutput->pos,
+ .width = woutput->width, .height = woutput->height,
+ .get_label = black_surface_get_label,
+ .surface_private = NULL,
+ .surface_committed = NULL,
+ .capture_input = true,
+ };
+
+ curtain = weston_shell_utils_curtain_create(ivi->compositor, &curtain_params);
+
+ weston_surface_set_role(curtain->view->surface,
+ "remote-output-background-surface", NULL, 0);
+
+ weston_view_move_to_layer(curtain->view, &ivi->background.view_list);
+ weston_view_set_output(curtain->view, woutput);
+
+ ivi_surf = zalloc(sizeof(*ivi_surf));
+ ivi_surf->view = curtain->view;
+ ivi_surf->ivi = ivi;
+ output->background = ivi_surf;
+
+ weston_log("(background) position view %p, x %f, y %f, on output %s\n", curtain->view,
+ woutput->pos.c.x, woutput->pos.c.y, output->name);
+
+ /* this background will always be available displayed, while
+ * the back curtain is installed/removed as we please */
+ remove_black_curtain(output);
+
+ /* force the surface to apepar on the remote side */
+ weston_compositor_damage_all(ivi->compositor);
return;
}
@@ -395,7 +443,7 @@ ivi_layout_activate_complete(struct ivi_output *output,
* we're trying to complete activation with means we're
* operating on the same app_id so do update previous_active as
* it will overwrite it with the same value */
- if (app_id && !strcmp(c_app_id, app_id)) {
+ if (c_app_id && app_id && !strcmp(c_app_id, app_id)) {
update_previous = false;
}
}