From f423719bd67611172fc26c88912e3cedca7830c1 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 23 Jun 2008 00:17:26 +0200 Subject: [PATCH] use gperf Signed-off-by: Pierre Habouzit --- common/tokenize.gperf | 4 ++++ mouse.c | 17 ++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 3b6f1453e..0e951823e 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -1,4 +1,8 @@ +bottomleft +bottomright center flex left right +topleft +topright diff --git a/mouse.c b/mouse.c index 0d992af26..94843c722 100644 --- a/mouse.c +++ b/mouse.c @@ -25,6 +25,7 @@ #include #include +#include "common/tokenize.h" #include "mouse.h" #include "screen.h" #include "tag.h" @@ -62,15 +63,13 @@ typedef enum static corner_t a_strtocorner(const char *str) { - if(!a_strcmp(str, "bottomright")) - return BottomRightCorner; - else if(!a_strcmp(str, "bottomleft")) - return BottomLeftCorner; - else if(!a_strcmp(str, "topleft")) - return TopLeftCorner; - else if(!a_strcmp(str, "topright")) - return TopRightCorner; - return AutoCorner; + switch (a_tokenize(str, -1)) { + case A_TK_BOTTOMRIGHT: return BottomRightCorner; + case A_TK_BOTTOMLEFT: return BottomLeftCorner; + case A_TK_TOPLEFT: return TopLeftCorner; + case A_TK_TOPRIGHT: return TopRightCorner; + default: return AutoCorner; + } } /** Snap an area to the outside of an area.