summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-02-17 16:48:27 +0200
committerMarius Vlad <marius.vlad@collabora.com>2020-03-04 13:46:26 +0200
commitaeab07ce4f1b216aea9a587453b8089c2e0f1846 (patch)
treebd0bd3c51718e084e54267e475d8a67b74e8e10e
parent3876e6f75a12bbec3ded07f9d16013c2e2c36e0a (diff)
protocol: Advertise the applications to regular clients
The application ids will be advertised when binding the protocol interface but also when the regular clients will create their surface. Client are responsible for filtering their own name. Bug-AGL: SPEC-3252 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ia196e7d3b34694d7cb169228429a0e940eae8b3b
-rw-r--r--protocol/agl-shell-desktop.xml12
-rw-r--r--src/shell.c24
2 files changed, 36 insertions, 0 deletions
diff --git a/protocol/agl-shell-desktop.xml b/protocol/agl-shell-desktop.xml
index ec5fc38..616da02 100644
--- a/protocol/agl-shell-desktop.xml
+++ b/protocol/agl-shell-desktop.xml
@@ -27,6 +27,18 @@
to activate other apps">
</description>
+ <event name="application">
+ <description summary="advertise app_id available for activating">
+ The compositor may choose to advertise one or more application ids which
+ can be used to switch to.
+
+ When this global is bound, the compositor will send all application ids
+ available for activation, but may send additional application id at any
+ time (when they've been mapped in the compositor).
+ </description>
+ <arg name="app_id" type="string"/>
+ </event>
+
<request name="activate_app">
<description summary="make client current window">
Ask the compositor to make a toplevel to become the current/focused
diff --git a/src/shell.c b/src/shell.c
index 9100ad7..cc7b33b 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -50,10 +50,19 @@ insert_black_surface(struct ivi_output *output);
void
ivi_set_desktop_surface(struct ivi_surface *surface)
{
+ struct desktop_client *dclient;
+ struct ivi_compositor *ivi = surface->ivi;
assert(surface->role == IVI_SURFACE_ROLE_NONE);
surface->role = IVI_SURFACE_ROLE_DESKTOP;
wl_list_insert(&surface->ivi->surfaces, &surface->link);
+
+ /* advertise to all desktop clients the new surface */
+ wl_list_for_each(dclient, &ivi->desktop_clients, link) {
+ const char *app_id =
+ weston_desktop_surface_get_app_id(surface->dsurface);
+ agl_shell_desktop_send_application(dclient->resource, app_id);
+ }
}
void
@@ -91,6 +100,18 @@ ivi_shell_init(struct ivi_compositor *ivi)
}
static void
+ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource *resource)
+{
+ struct ivi_surface *surface;
+
+ wl_list_for_each(surface, &ivi->surfaces, link) {
+ const char *app_id =
+ weston_desktop_surface_get_app_id(surface->dsurface);
+ agl_shell_desktop_send_application(resource, app_id);
+ }
+}
+
+static void
client_exec(const char *command, int fd)
{
sigset_t sig;
@@ -565,6 +586,9 @@ bind_agl_shell_desktop(struct wl_client *client,
dclient->resource = resource;
wl_list_insert(&ivi->desktop_clients, &dclient->link);
+
+ /* advertise xdg surfaces */
+ ivi_shell_advertise_xdg_surfaces(ivi, resource);
}
int