aboutsummaryrefslogtreecommitdiffstats
path: root/src/shell.c
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-05-21 01:29:37 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-05-25 14:39:41 +0300
commit353064abff83403f8a6e46f0469c4dc07b648534 (patch)
treeb57cac83479565ed3c032d4fb5fbaf94657c0d58 /src/shell.c
parent056e977e85cc40774a82659819ccb455056fbb39 (diff)
src/ Adding remote surface rolesandbox/mvlad/appids-per-output
This patch adds the 'remote' surface role, which clients can make use of to hint the compositor that is should place the surface on other output. While both private extension protocols explicitly require to provide an wl_output when activating or when setting surface roles, we still need the inform the compositor that the surface should be placed on another output. This is due to the activate_by_default functionality that requires having an output being present, with the default regular XDG desktop roles deriving its own output by using output of the backgound surface role. Just like pop-up dialog role and split surface role this patch adds another temporary hold up place before the surface is actually created. Once that is done the surface role will be re-assigned to the desktop role (being no difference whatsoever between them). Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I8804cc3478974f0b0cb323db46cb0814405c34d1
Diffstat (limited to 'src/shell.c')
-rw-r--r--src/shell.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c
index cb70691..3205804 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -87,6 +87,18 @@ ivi_set_desktop_surface_fs(struct ivi_surface *surface)
}
static void
+ivi_set_desktop_surface_remote(struct ivi_surface *surface)
+{
+ struct ivi_compositor *ivi = surface->ivi;
+ 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;
+ wl_list_insert(&ivi->surfaces, &surface->link);
+}
+
+static void
ivi_set_desktop_surface_split(struct ivi_surface *surface)
{
struct ivi_compositor *ivi = surface->ivi;
@@ -166,6 +178,23 @@ ivi_set_pending_desktop_surface_split(struct ivi_output *ioutput,
}
static void
+ivi_set_pending_desktop_surface_remote(struct ivi_output *ioutput,
+ const char *app_id)
+{
+ struct ivi_compositor *ivi = ioutput->ivi;
+ size_t len_app_id = strlen(app_id);
+
+ struct pending_remote *remote = zalloc(sizeof(*remote));
+
+ remote->app_id = zalloc(sizeof(char) * (len_app_id + 1));
+ memcpy(remote->app_id, app_id, len_app_id);
+
+ remote->ioutput = ioutput;
+
+ wl_list_insert(&ivi->remote_pending_apps, &remote->link);
+}
+
+static void
ivi_remove_pending_desktop_surface_split(struct pending_split *split)
{
free(split->app_id);
@@ -189,6 +218,14 @@ ivi_remove_pending_desktop_surface_popup(struct pending_popup *p_popup)
free(p_popup);
}
+static void
+ivi_remove_pending_desktop_surface_remote(struct pending_remote *remote)
+{
+ free(remote->app_id);
+ wl_list_remove(&remote->link);
+ free(remote);
+}
+
static bool
ivi_check_pending_desktop_surface_popup(struct ivi_surface *surface)
{
@@ -261,6 +298,29 @@ ivi_check_pending_desktop_surface_fs(struct ivi_surface *surface)
return false;
}
+static bool
+ivi_check_pending_desktop_surface_remote(struct ivi_surface *surface)
+{
+ struct pending_remote *remote_surf, *next_remote_surf;
+ struct ivi_compositor *ivi = surface->ivi;
+ const char *_app_id =
+ weston_desktop_surface_get_app_id(surface->dsurface);
+
+ if (wl_list_empty(&ivi->remote_pending_apps))
+ return false;
+
+ wl_list_for_each_safe(remote_surf, next_remote_surf,
+ &ivi->remote_pending_apps, link) {
+ if (!strcmp(_app_id, remote_surf->app_id)) {
+ surface->remote.output = remote_surf->ioutput;
+ ivi_remove_pending_desktop_surface_remote(remote_surf);
+ return true;
+ }
+ }
+
+ return false;
+}
+
void
ivi_check_pending_desktop_surface(struct ivi_surface *surface)
{
@@ -284,6 +344,12 @@ ivi_check_pending_desktop_surface(struct ivi_surface *surface)
return;
}
+ ret = ivi_check_pending_desktop_surface_remote(surface);
+ if (ret) {
+ ivi_set_desktop_surface_remote(surface);
+ return;
+ }
+
/* if we end up here means we have a regular desktop app and
* try to activate it */
ivi_set_desktop_surface(surface);
@@ -767,6 +833,9 @@ shell_desktop_set_app_property(struct wl_client *client,
case AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_HORIZONTAL:
ivi_set_pending_desktop_surface_split(output, app_id, role);
break;
+ case AGL_SHELL_DESKTOP_APP_ROLE_REMOTE:
+ ivi_set_pending_desktop_surface_remote(output, app_id);
+ break;
default:
break;
}