aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2023-03-02 21:30:31 +0100
committerIsaac Freund <mail@isaacfreund.com>2023-03-02 21:31:51 +0100
commit5ae17de23f5fd9bb252a698f3771c840280e2c05 (patch)
treeed5cd1cb5950ef014e092726a69fa3aee940995f
parent97c8ad7c65f397368867310308c96c59b59ef2bd (diff)
xdg-shell: improve validation of resize edges
The current validation doesn't catch some invalid values such as 3 or 7.
-rw-r--r--types/xdg_shell/wlr_xdg_toplevel.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c
index a0405d4d..526f4833 100644
--- a/types/xdg_shell/wlr_xdg_toplevel.c
+++ b/types/xdg_shell/wlr_xdg_toplevel.c
@@ -313,7 +313,17 @@ static void xdg_toplevel_handle_resize(struct wl_client *client,
struct wlr_seat_client *seat =
wlr_seat_client_from_resource(seat_resource);
- if (edges > XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT) {
+ switch (edges) {
+ case XDG_TOPLEVEL_RESIZE_EDGE_TOP:
+ case XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM:
+ case XDG_TOPLEVEL_RESIZE_EDGE_LEFT:
+ case XDG_TOPLEVEL_RESIZE_EDGE_RIGHT:
+ case XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT:
+ case XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT:
+ case XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT:
+ case XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT:
+ break;
+ default:
wl_resource_post_error(toplevel->base->resource,
XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE,
"provided value is not a valid variant of the resize_edge enum");