summaryrefslogtreecommitdiff
path: root/src/mtstate.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-06-15 20:24:14 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:28:08 +0200
commit78085b21f2dc7b1d49a0c54ab56b567fc195d440 (patch)
tree3ae649c25b380114ce2eaa5463350fb9b29ee78c /src/mtstate.c
parent4583da1ad81b59b2a8cd2ae51c32b1bc8d32f1c4 (diff)
refactor: Simplify capabilities
Use the generated abs2mt mapping to simplify the MT device capabilities. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
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 @@
#include "mtstate.h"
#define TOUCH_WIDTH(hw) (0.05 * hw->width_major)
-#define TOUCH_SCALE(caps) (0.05 * caps->abs_touch_major.maximum)
+#define TOUCH_SCALE(caps) (0.05 * caps->abs[BIT_TOUCH_MAJOR].maximum)
#define THUMB_TOUCH(hw) (1.2 * hw->touch_minor)
#define THUMB_WIDTH_TOUCH(hw) (3 * hw->touch_major)
@@ -37,9 +37,9 @@ void init_mtstate(struct MTState *s)
static int touching_finger(const struct FingerData *hw,
const struct Capabilities *caps)
{
- if (caps->has_touch_major && caps->has_width_major)
+ if (caps->has_abs[BIT_TOUCH_MAJOR] && caps->has_abs[BIT_WIDTH_MAJOR])
return hw->touch_major > TOUCH_WIDTH(hw);
- if (caps->has_touch_major)
+ if (caps->has_abs[BIT_TOUCH_MAJOR])
return hw->touch_major > TOUCH_SCALE(caps);
return 1;
}
@@ -55,8 +55,10 @@ static int touching_finger(const struct FingerData *hw,
static int thumb_finger(const struct FingerData *hw,
const struct Capabilities *caps)
{
- if (!caps->has_touch_major || !caps->has_touch_minor ||
- !caps->has_width_major || !caps->has_width_minor)
+ if (!caps->has_abs[BIT_TOUCH_MAJOR] ||
+ !caps->has_abs[BIT_TOUCH_MINOR] ||
+ !caps->has_abs[BIT_WIDTH_MAJOR] ||
+ !caps->has_abs[BIT_WIDTH_MINOR])
return 0;
return hw->touch_major > THUMB_TOUCH(hw) &&
hw->width_major > THUMB_WIDTH_TOUCH(hw) &&