summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2022-10-18 23:32:40 +0300
committerMarius Vlad <marius.vlad@collabora.com>2022-10-21 20:16:53 +0300
commit0eedfd70b4682a51c81b4b8738ab42f665dc8798 (patch)
tree30e4b432cf5bfc6b14a9396da1ae295418a330f7
parentc5a4b229486a1b26890ed06ef251e473f0fd8c0b (diff)
src/shell: Add a wrappers for sending events with agl-shell
As we now have one more (shell) client that can bind to agl-shell, add a wrapper for sending the events and include it as well. Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I869b036d6f24beeb3089bfd24b8d233c5fada71f
-rw-r--r--src/desktop.c12
-rw-r--r--src/ivi-compositor.h4
-rw-r--r--src/layout.c9
-rw-r--r--src/shell.c22
4 files changed, 26 insertions, 21 deletions
diff --git a/src/desktop.c b/src/desktop.c
index 0e71de9..dfcc24d 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -369,12 +369,8 @@ skip_output_asignment:
if (app_id && output) {
shell_advertise_app_state(output->ivi, app_id,
NULL, AGL_SHELL_DESKTOP_APP_STATE_DESTROYED);
-
- if (output->ivi->shell_client.ready &&
- wl_resource_get_version(output->ivi->shell_client.resource)
- >= AGL_SHELL_APP_STATE_SINCE_VERSION)
- agl_shell_send_app_state(output->ivi->shell_client.resource,
- app_id, AGL_SHELL_APP_STATE_TERMINATED);
+ if (output->ivi->shell_client.ready)
+ shell_send_app_state(output->ivi, app_id, AGL_SHELL_APP_STATE_TERMINATED);
}
wl_list_remove(&surface->link);
@@ -407,9 +403,7 @@ desktop_committed(struct weston_desktop_surface *dsurface,
/* we'll do it now at commit time, because we might not have an
* appid by the time we've created the weston_desktop_surface
* */
- if (wl_resource_get_version(ivi->shell_client.resource) >= AGL_SHELL_APP_STATE_SINCE_VERSION)
- agl_shell_send_app_state(ivi->shell_client.resource,
- app_id, AGL_SHELL_APP_STATE_STARTED);
+ shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_STARTED);
}
if (!surface->advertised_on_launch &&
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
index 1d03747..889c3f3 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
@@ -498,4 +498,8 @@ ivi_shell_activate_surface(struct ivi_surface *ivi_surf,
int
sigchld_handler(int signal_number, void *data);
+void
+shell_send_app_state(struct ivi_compositor *ivi, const char *app_id,
+ enum agl_shell_app_state state);
+
#endif
diff --git a/src/layout.c b/src/layout.c
index 96eb215..042fa55 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -308,10 +308,7 @@ ivi_layout_activate_complete(struct ivi_output *output,
app_id,
ivi_layout_get_surface_role_name(surf), output->name);
- if (wl_resource_get_version(ivi->shell_client.resource) >= AGL_SHELL_APP_STATE_SINCE_VERSION)
- agl_shell_send_app_state(ivi->shell_client.resource,
- app_id, AGL_SHELL_APP_STATE_ACTIVATED);
-
+ shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_ACTIVATED);
}
struct ivi_output *
@@ -1061,7 +1058,5 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
weston_surface_damage(view->surface);
}
- if (wl_resource_get_version(ivi->shell_client.resource) >= AGL_SHELL_APP_STATE_SINCE_VERSION)
- agl_shell_send_app_state(ivi->shell_client.resource, app_id,
- AGL_SHELL_APP_STATE_DEACTIVATED);
+ shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED);
}
diff --git a/src/shell.c b/src/shell.c
index 9fe6cf1..f8d2e32 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1138,6 +1138,22 @@ insert_black_curtain(struct ivi_output *output)
weston_log("Added black curtain to output %s\n", output->output->name);
}
+void
+shell_send_app_state(struct ivi_compositor *ivi, const char *app_id,
+ enum agl_shell_app_state state)
+{
+ if (app_id && wl_resource_get_version(ivi->shell_client.resource) >=
+ AGL_SHELL_APP_STATE_SINCE_VERSION) {
+
+ agl_shell_send_app_state(ivi->shell_client.resource,
+ app_id, state);
+
+ if (ivi->shell_client_ext.resource)
+ agl_shell_send_app_state(ivi->shell_client_ext.resource,
+ app_id, state);
+ }
+}
+
static void
shell_ready(struct wl_client *client, struct wl_resource *shell_res)
{
@@ -1176,11 +1192,7 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res)
surface->checked_pending = true;
app_id = weston_desktop_surface_get_app_id(surface->dsurface);
- if (app_id &&
- wl_resource_get_version(ivi->shell_client.resource) >=
- AGL_SHELL_APP_STATE_SINCE_VERSION)
- agl_shell_send_app_state(ivi->shell_client.resource,
- app_id, AGL_SHELL_APP_STATE_STARTED);
+ shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_STARTED);
}
}