aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-02-15 08:07:57 +0100
committerDominique Martinet <asmadeus@codewreck.org>2018-02-15 08:07:57 +0100
commit56ab3e9b10fdaaf41eef6e47f81ffe54fd9d5a77 (patch)
tree42483e403d2acb7edce20be846941c69a82dc833
parent714f90a9d0027d562bf22a563edee23ca877e618 (diff)
xdg_shell stable: fix zero-sized positioner anchor_rect
We used 0 as unset-check value before, which was fine when 0-width was invalid, but isn't anymore
-rw-r--r--types/wlr_xdg_shell.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c
index 914ee322..53ff25d0 100644
--- a/types/wlr_xdg_shell.c
+++ b/types/wlr_xdg_shell.c
@@ -334,6 +334,10 @@ static void xdg_shell_create_positioner(struct wl_client *wl_client,
return;
}
+ /* set widths to detect improper usages of get_popup */
+ positioner->size.width = -1;
+ positioner->anchor_rect.width = -1;
+
positioner->resource = wl_resource_create(wl_client,
&xdg_positioner_interface,
wl_resource_get_version(resource),
@@ -500,7 +504,7 @@ static void xdg_surface_get_popup(struct wl_client *client,
struct wlr_xdg_positioner *positioner =
wl_resource_get_user_data(positioner_resource);
- if (positioner->size.width == 0 || positioner->anchor_rect.width == 0) {
+ if (positioner->size.width == -1 || positioner->anchor_rect.width == -1) {
wl_resource_post_error(resource,
XDG_WM_BASE_ERROR_INVALID_POSITIONER,
"positioner object is not complete");