summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Majerech <majerech.o@gmail.com>2014-08-21 15:47:22 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-08-27 16:03:49 +0300
commitae9c4fc39f83516aa65098d706959da24930b8cc (patch)
tree790c8cd6fc3f584635be1c7ca00fb09adb7cfdc5
parentca3626074a91a7fc7bb6531b446e0a4df0cf6ad0 (diff)
desktop-shell: Replace magic constants with named ones
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com> Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
-rw-r--r--desktop-shell/shell.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 99f3343f..c8a9f010 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1887,13 +1887,20 @@ surface_resize(struct shell_surface *shsurf,
struct weston_seat *seat, uint32_t edges)
{
struct weston_resize_grab *resize;
+ const unsigned resize_topbottom =
+ WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_BOTTOM;
+ const unsigned resize_leftright =
+ WL_SHELL_SURFACE_RESIZE_LEFT | WL_SHELL_SURFACE_RESIZE_RIGHT;
+ const unsigned resize_any = resize_topbottom | resize_leftright;
if (shsurf->grabbed ||
shsurf->state.fullscreen || shsurf->state.maximized)
return 0;
- if (edges == 0 || edges > 15 ||
- (edges & 3) == 3 || (edges & 12) == 12)
+ /* Check for invalid edge combinations. */
+ if (edges == WL_SHELL_SURFACE_RESIZE_NONE || edges > resize_any ||
+ (edges & resize_topbottom) == resize_topbottom ||
+ (edges & resize_leftright) == resize_leftright)
return 0;
resize = malloc(sizeof *resize);