summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-01-04 16:42:43 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-01-05 13:56:45 +0200
commit00dc74242844cbaa982b470e23542b866c51240b (patch)
tree72cc29aa35ac14dbe1b1c1deb3ae1da6622b3541
parentc0f21f14f0d57398a587dacbc9b7655d96c1ed3d (diff)
shell: Verify agl-shell version for bound_ok/bound_failsandbox/mvlad/fix-shell-v1
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 <marius.vlad@collabora.com> Change-Id: I4f5d34fd8b9fe6cf6b8097948afebee550f5345d
-rw-r--r--src/shell.c25
1 files 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;
}