chiark / gitweb /
Button zones: Remove inexplicable pad_with/2 offset
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Apr 2016 18:27:28 +0000 (19:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Apr 2016 19:42:32 +0000 (20:42 +0100)
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 <ijackson@chiark.greenend.org.uk>
src/gestures.c

index 5262fbd48442045789630384f9e93a56f1137d55..208b39ac46c40cacf8b7e12b2cf9f7b208b11a28 100644 (file)
@@ -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);