diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2022-10-18 23:32:40 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2022-12-05 15:27:26 +0200 |
commit | c42f50b567a0d5adf2c51322d4d46e33ce4ccb59 (patch) | |
tree | f69d295a3cc5883842e6ba669e98f6579451a8a5 | |
parent | 05bb0384732480a9f24a8d9093ac2da20081e307 (diff) |
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.
Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I869b036d6f24beeb3089bfd24b8d233c5fada71f
-rw-r--r-- | src/desktop.c | 12 | ||||
-rw-r--r-- | src/ivi-compositor.h | 7 | ||||
-rw-r--r-- | src/layout.c | 9 | ||||
-rw-r--r-- | src/shell.c | 28 |
4 files changed, 31 insertions, 25 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..463ae2b 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -87,7 +87,8 @@ struct ivi_compositor { struct wl_client *client; struct wl_resource *resource; - struct wl_client *client_ext; + /* this is for another agl-shell client, potentially used by + * the grpc-proxy */ struct wl_resource *resource_ext; bool ready; enum agl_shell_bound_status status; @@ -498,4 +499,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 1773fc8..f2fc6cc 100644 --- a/src/layout.c +++ b/src/layout.c @@ -312,10 +312,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 * @@ -1072,7 +1069,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 ab74f69..4f33103 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1148,6 +1148,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.resource_ext) + agl_shell_send_app_state(ivi->shell_client.resource_ext, + app_id, state); + } +} + static void shell_ready(struct wl_client *client, struct wl_resource *shell_res) { @@ -1192,11 +1208,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); } } @@ -1660,13 +1672,13 @@ bind_agl_shell(struct wl_client *client, wl_resource_set_implementation(resource, &agl_shell_implementation, ivi, NULL); - ivi->shell_client_ext.resource = resource; + ivi->shell_client.resource_ext = resource; if (ivi->shell_client.status == BOUND_OK && wl_resource_get_version(resource) >= AGL_SHELL_BOUND_OK_SINCE_VERSION) { - weston_log("Sent agl_shell_send_bound_ok to client ext\n"); ivi->shell_client_ext.status = BOUND_OK; - agl_shell_send_bound_ok(ivi->shell_client_ext.resource); + agl_shell_send_bound_ok(ivi->shell_client.resource_ext); + weston_log("agl_shell_send_bound_ok to client ext\n"); } return; |