From: Ian Jackson Date: Sat, 23 Apr 2016 18:27:28 +0000 (+0100) Subject: Button zones: Remove inexplicable pad_with/2 offset X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=88e8d8d49cc5e462b8b385a20c0a46d9a34145f1;p=xf86-input-mtrack.git Button zones: Remove inexplicable pad_with/2 offset When button zones are in use, the code attempts to calculate which zone the finger is in. The left and right edges of the zones are calculated according the nths of pad_width, where n is the number of zones. These left and right sides are compared with `pos', and the zone is the one where left<=pos<=right. This would all be correct if pos were the touch's x coordinate. However, inexplicably, it isn't: it has had pad_width/2 added. The git history does not reveal an explanation for adding pad_width/2. Removing it makes the button zones work. Signed-off-by: Ian Jackson --- diff --git a/src/gestures.c b/src/gestures.c index 5262fbd..208b39a 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -224,7 +224,7 @@ static void buttons_update(struct Gestures* gs, if (zones > 0) { width = ((double)cfg->pad_width)/((double)zones); - pos = cfg->pad_width / 2 + ms->touch[earliest].x; + 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);