<div dir="ltr"><div>This looks much more readable to me. Unnamed magic numbers are always confusing.<br></div><div><br></div>Reviewed-by: Nils Chr. Brause <<a href="mailto:nilschrbrause@gmail.com">nilschrbrause@gmail.com</a>><br>
<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 21, 2014 at 3:47 PM, Ondřej Majerech <span dir="ltr"><<a href="mailto:majerech.o@gmail.com" target="_blank">majerech.o@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Ondřej Majerech <<a href="mailto:majerech.o@gmail.com">majerech.o@gmail.com</a>><br>
---<br>
desktop-shell/shell.c | 11 +++++++++--<br>
1 file changed, 9 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c<br>
index e3abaad..02e180d 100644<br>
--- a/desktop-shell/shell.c<br>
+++ b/desktop-shell/shell.c<br>
@@ -1884,13 +1884,20 @@ surface_resize(struct shell_surface *shsurf,<br>
struct weston_seat *seat, uint32_t edges)<br>
{<br>
struct weston_resize_grab *resize;<br>
+ const unsigned resize_topbottom =<br>
+ WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_BOTTOM;<br>
+ const unsigned resize_leftright =<br>
+ WL_SHELL_SURFACE_RESIZE_LEFT | WL_SHELL_SURFACE_RESIZE_RIGHT;<br>
+ const unsigned resize_any = resize_topbottom | resize_leftright;<br>
<br>
if (shsurf->grabbed ||<br>
shsurf->state.fullscreen || shsurf->state.maximized)<br>
return 0;<br>
<br>
- if (edges == 0 || edges > 15 ||<br>
- (edges & 3) == 3 || (edges & 12) == 12)<br>
+ /* Check for invalid edge combinations. */<br>
+ if (edges == WL_SHELL_SURFACE_RESIZE_NONE || edges > resize_any ||<br>
+ (edges & resize_topbottom) == resize_topbottom ||<br>
+ (edges & resize_leftright) == resize_leftright)<br>
return 0;<br>
<br>
resize = malloc(sizeof *resize);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.4<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>