From: Ian Jackson Date: Sat, 23 Apr 2016 18:51:48 +0000 (+0100) Subject: Button zones: Refactor, preparatory to BottomEdgeZones X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7a57045f656241ca22c86efe7e757064582faca3;p=xf86-input-mtrack.git 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 --- 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);