From 7a57045f656241ca22c86efe7e757064582faca3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 19:51:48 +0100 Subject: [PATCH] Button zones: Refactor, preparatory to BottomEdgeZones I intend to add a new feature BottomEdgeZones which reuses the Zone machinery, but is going to use a different source for the effective X coordinate which selects the zone. Break out the computation of `pos'. pos==-1 means the zone feature is not in use or not applicable to the event. No functional change in this commit. Signed-off-by: Ian Jackson --- src/gestures.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gestures.c b/src/gestures.c index 208b39a..5922c00 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -210,8 +210,14 @@ static void buttons_update(struct Gestures* gs, } if (emulate) { + int pos = -1; + if (cfg->button_zones && earliest >= 0) { - int zones, left, right, pos; + pos = ms->touch[earliest].x; + } + + if (pos >= 0) { + int zones, left, right; double width; zones = 0; @@ -224,7 +230,6 @@ static void buttons_update(struct Gestures* gs, if (zones > 0) { width = ((double)cfg->pad_width)/((double)zones); - pos = ms->touch[earliest].x; #ifdef DEBUG_GESTURES xf86Msg(X_INFO, "buttons_update: pad width %d, zones %d, zone width %f, x %d\n", cfg->pad_width, zones, width, pos); -- 2.30.2