From 88e8d8d49cc5e462b8b385a20c0a46d9a34145f1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 19:27:28 +0100 Subject: [PATCH] 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 --- src/gestures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2