Check positioner anchor and gravity enums

Signed-off-by: Robert Ancell <robert.ancell@canonical.com>
This commit is contained in:
Robert Ancell 2026-04-22 10:36:45 +12:00
parent e0c5b8a26b
commit 752fc7fa12
No known key found for this signature in database
GPG key ID: 5A4D9816CA519FBD

View file

@ -619,6 +619,13 @@ weston_desktop_xdg_positioner_protocol_set_anchor(struct wl_client *wl_client,
struct weston_desktop_xdg_positioner *positioner =
wl_resource_get_user_data(resource);
if (anchor > XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT) {
wl_resource_post_error(resource,
XDG_POSITIONER_ERROR_INVALID_INPUT,
"anchor must be in the anchor enum");
return;
}
positioner->anchor = anchor;
}
@ -630,6 +637,13 @@ weston_desktop_xdg_positioner_protocol_set_gravity(struct wl_client *wl_client,
struct weston_desktop_xdg_positioner *positioner =
wl_resource_get_user_data(resource);
if (gravity > XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT) {
wl_resource_post_error(resource,
XDG_POSITIONER_ERROR_INVALID_INPUT,
"gravity must be in the gravity enum");
return;
}
positioner->gravity = gravity;
}