From 00dc74242844cbaa982b470e23542b866c51240b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 4 Jan 2023 16:42:43 +0200 Subject: shell: Verify agl-shell version for bound_ok/bound_fail Some additional checks to avoid cases where agl-shell is still using the version 1 but we're checking against at least version 2 (where we introduced some additional events). Part of the compat series. Signed-off-by: Marius Vlad Change-Id: I4f5d34fd8b9fe6cf6b8097948afebee550f5345d --- src/shell.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/shell.c b/src/shell.c index 4f564af..d9d3c2d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1174,7 +1174,9 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res) struct ivi_output *output; struct ivi_surface *surface, *tmp; - if (ivi->shell_client.status == BOUND_FAILED) { + if (wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1228,8 +1230,10 @@ shell_set_background(struct wl_client *client, struct weston_desktop_surface *dsurface; struct ivi_surface *surface; - if (ivi->shell_client.status == BOUND_FAILED || - ivi->shell_client.resource_ext == shell_res) { + if ((wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) || + ivi->shell_client.resource_ext == shell_res) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1291,7 +1295,9 @@ shell_set_panel(struct wl_client *client, struct ivi_surface **member; int32_t width = 0, height = 0; - if (ivi->shell_client.status == BOUND_FAILED || + if ((wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) || ivi->shell_client.resource_ext == shell_res) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1408,7 +1414,9 @@ shell_activate_app(struct wl_client *client, struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res); struct ivi_output *output = to_ivi_output(woutput); - if (ivi->shell_client.status == BOUND_FAILED) { + if (wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1453,7 +1461,8 @@ shell_destroy(struct wl_client *client, struct wl_resource *res) struct ivi_compositor *ivi = wl_resource_get_user_data(res); /* reset status in case bind_fail was sent */ - if (ivi->shell_client.status == BOUND_FAILED) + if (wl_resource_get_version(res) >= AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) ivi->shell_client.status = BOUND_OK; } @@ -1594,7 +1603,9 @@ unbind_agl_shell(struct wl_resource *resource) ivi = wl_resource_get_user_data(resource); /* reset status to allow other clients issue legit requests */ - if (ivi->shell_client.status == BOUND_FAILED) { + if (wl_resource_get_version(resource) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { ivi->shell_client.status = BOUND_OK; return; } -- cgit 1.2.3-korg