Skip to content

Commit

Permalink
Enforce minimum touch point size
Browse files Browse the repository at this point in the history
Devices that don't give major/minor in surface coordinates produce no output
otherwise. The Elan touchscreen in the T440s announces major/minor with a max
of 255, an average finger produces in the 2-3 range.

That also causes some artefacts in general, since the major/minor tend to stay
the same, a touch may not have the right values until it changes. Use of
EVIOCGMTSLOTS is needed here to sync the original value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Oct 28, 2014
1 parent 6c7ed50 commit 41895ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/mtview.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <poll.h>

#define DEFAULT_WIDTH 200
#define MIN_WIDTH 5
#define DEFAULT_WIDTH_MULTIPLIER 5 /* if no major/minor give the actual size */

#define DIM_TOUCH 32
Expand Down Expand Up @@ -192,8 +193,8 @@ static void output_touch(const struct touch_info *touch_info,

float ac = fabs(cos(angle));
float as = fabs(sin(angle));
float mx = max(minor * ac, major * as) * dx;
float my = max(major * ac, minor * as) * dy;
float mx = max(MIN_WIDTH, max(minor * ac, major * as) * dx);
float my = max(MIN_WIDTH, max(major * ac, minor * as) * dy);

if (w->id[t->data[ABS_MT_SLOT]] != t->data[ABS_MT_TRACKING_ID]) {
w->id[t->data[ABS_MT_SLOT]] = t->data[ABS_MT_TRACKING_ID];
Expand Down

0 comments on commit 41895ea

Please sign in to comment.