summaryrefslogtreecommitdiff
path: root/src/mtstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mtstate.c')
-rw-r--r--src/mtstate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mtstate.c b/src/mtstate.c
index 1e2eeef..2403765 100644
--- a/src/mtstate.c
+++ b/src/mtstate.c
@@ -22,7 +22,7 @@
22#include "mtstate.h" 22#include "mtstate.h"
23 23
24#define TOUCH_WIDTH(hw) (0.05 * hw->width_major) 24#define TOUCH_WIDTH(hw) (0.05 * hw->width_major)
25#define TOUCH_SCALE(caps) (0.05 * caps->abs_touch_major.maximum) 25#define TOUCH_SCALE(caps) (0.05 * caps->abs[BIT_TOUCH_MAJOR].maximum)
26 26
27#define THUMB_TOUCH(hw) (1.2 * hw->touch_minor) 27#define THUMB_TOUCH(hw) (1.2 * hw->touch_minor)
28#define THUMB_WIDTH_TOUCH(hw) (3 * hw->touch_major) 28#define THUMB_WIDTH_TOUCH(hw) (3 * hw->touch_major)
@@ -37,9 +37,9 @@ void init_mtstate(struct MTState *s)
37static int touching_finger(const struct FingerData *hw, 37static int touching_finger(const struct FingerData *hw,
38 const struct Capabilities *caps) 38 const struct Capabilities *caps)
39{ 39{
40 if (caps->has_touch_major && caps->has_width_major) 40 if (caps->has_abs[BIT_TOUCH_MAJOR] && caps->has_abs[BIT_WIDTH_MAJOR])
41 return hw->touch_major > TOUCH_WIDTH(hw); 41 return hw->touch_major > TOUCH_WIDTH(hw);
42 if (caps->has_touch_major) 42 if (caps->has_abs[BIT_TOUCH_MAJOR])
43 return hw->touch_major > TOUCH_SCALE(caps); 43 return hw->touch_major > TOUCH_SCALE(caps);
44 return 1; 44 return 1;
45} 45}
@@ -55,8 +55,10 @@ static int touching_finger(const struct FingerData *hw,
55static int thumb_finger(const struct FingerData *hw, 55static int thumb_finger(const struct FingerData *hw,
56 const struct Capabilities *caps) 56 const struct Capabilities *caps)
57{ 57{
58 if (!caps->has_touch_major || !caps->has_touch_minor || 58 if (!caps->has_abs[BIT_TOUCH_MAJOR] ||
59 !caps->has_width_major || !caps->has_width_minor) 59 !caps->has_abs[BIT_TOUCH_MINOR] ||
60 !caps->has_abs[BIT_WIDTH_MAJOR] ||
61 !caps->has_abs[BIT_WIDTH_MINOR])
60 return 0; 62 return 0;
61 return hw->touch_major > THUMB_TOUCH(hw) && 63 return hw->touch_major > THUMB_TOUCH(hw) &&
62 hw->width_major > THUMB_WIDTH_TOUCH(hw) && 64 hw->width_major > THUMB_WIDTH_TOUCH(hw) &&