From c955301a359ad174ab804e7390b12658118d6de9 Mon Sep 17 00:00:00 2001 From: xurui Date: Wed, 23 Oct 2024 18:43:27 +0800 Subject: [PATCH] xdg-toplevel: use enum_is_valid functions Signed-off-by: xurui --- types/xdg_shell/wlr_xdg_toplevel.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 556dcf80..bfb583bc 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -297,18 +297,8 @@ static void xdg_toplevel_handle_resize(struct wl_client *client, struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource); - switch (edges) { - case XDG_TOPLEVEL_RESIZE_EDGE_NONE: - 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: + uint32_t version = wl_resource_get_version(toplevel->base->resource); + if (!xdg_toplevel_resize_edge_is_valid(edges, version)) { 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");