diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-10-16 16:04:42 +0200 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2010-10-16 16:26:51 +0200 |
commit | 9b60b3ec355f91cad0323b4063267056c3971a90 (patch) | |
tree | 953f90c3f9f806f044a60ecba770e8ad78be150b | |
parent | f7ddb42644c428c6b375107864b7ad435c2988d8 (diff) | |
download | xorg-input-kobomultitouch-9b60b3ec355f91cad0323b4063267056c3971a90.tar.gz xorg-input-kobomultitouch-9b60b3ec355f91cad0323b4063267056c3971a90.tar.bz2 xorg-input-kobomultitouch-9b60b3ec355f91cad0323b4063267056c3971a90.zip |
Support palm detection for trackpads without width support
The Magic Trackpad does not report both touch and width of a finger,
making thumb/palm detection less reliable. Approximate thumb detection
as a large oval object, restoring some of the thumb functionality.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r-- | src/mtstate.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mtstate.c b/src/mtstate.c index 313550b..771048d 100644 --- a/src/mtstate.c +++ b/src/mtstate.c @@ -25,6 +25,7 @@ #define TOUCH_SCALE(caps) (0.05 * caps->abs[MTDEV_TOUCH_MAJOR].maximum) #define THUMB_TOUCH(hw) (1.2 * hw->touch_minor) +#define THUMB_TOUCH_SIZE(hw, caps) (0.14 * get_cap_xsize(caps)) #define THUMB_WIDTH_TOUCH(hw) (4 * hw->touch_major) #define THUMB_WIDTH_WIDTH(hw) (1.2 * hw->width_minor) #define THUMB_WIDTH_SIZE(hw, caps) (0.25 * get_cap_xsize(caps)) @@ -56,10 +57,13 @@ static int is_thumb(const struct FingerState *hw, const struct Capabilities *caps) { if (!caps->has_abs[MTDEV_TOUCH_MAJOR] || - !caps->has_abs[MTDEV_TOUCH_MINOR] || - !caps->has_abs[MTDEV_WIDTH_MAJOR] || - !caps->has_abs[MTDEV_WIDTH_MINOR]) + !caps->has_abs[MTDEV_TOUCH_MINOR]) return 0; + if (!caps->has_abs[MTDEV_WIDTH_MAJOR] || + !caps->has_abs[MTDEV_WIDTH_MINOR]) { + return hw->touch_major > THUMB_TOUCH(hw) && + hw->touch_major > THUMB_TOUCH_SIZE(hw, caps); + } return hw->touch_major > THUMB_TOUCH(hw) && hw->width_major > THUMB_WIDTH_TOUCH(hw) && hw->width_major > THUMB_WIDTH_WIDTH(hw) && |