summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hwstate.c18
-rw-r--r--src/memory.c10
-rw-r--r--src/mtstate.c12
3 files changed, 23 insertions, 17 deletions
diff --git a/src/hwstate.c b/src/hwstate.c
index 81f4b8b..032351c 100644
--- a/src/hwstate.c
+++ b/src/hwstate.c
@@ -21,7 +21,7 @@
21 21
22#include "hwstate.h" 22#include "hwstate.h"
23 23
24#define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) 24#define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_abs[BIT_TOUCH_MAJOR])
25 25
26void init_hwstate(struct HWState *s) 26void init_hwstate(struct HWState *s)
27{ 27{
@@ -49,12 +49,12 @@ static void set_finger(struct FingerState *fs,
49 const struct FingerData *hw, int id, 49 const struct FingerData *hw, int id,
50 const struct Capabilities *caps) 50 const struct Capabilities *caps)
51{ 51{
52 int x = defuzz(hw->position_x, fs->hw.position_x, caps->xfuzz); 52 int x = defuzz(hw->position_x, fs->hw.position_x, caps->abs[BIT_POSITION_X].fuzz);
53 int y = defuzz(hw->position_y, fs->hw.position_y, caps->yfuzz); 53 int y = defuzz(hw->position_y, fs->hw.position_y, caps->abs[BIT_POSITION_Y].fuzz);
54 int tj = defuzz(hw->touch_major, fs->hw.touch_major, caps->wfuzz); 54 int tj = defuzz(hw->touch_major, fs->hw.touch_major, caps->abs[BIT_TOUCH_MAJOR].fuzz);
55 int tn = defuzz(hw->touch_minor, fs->hw.touch_minor, caps->wfuzz); 55 int tn = defuzz(hw->touch_minor, fs->hw.touch_minor, caps->abs[BIT_TOUCH_MAJOR].fuzz);
56 int wj = defuzz(hw->width_major, fs->hw.width_major, caps->wfuzz); 56 int wj = defuzz(hw->width_major, fs->hw.width_major, caps->abs[BIT_TOUCH_MAJOR].fuzz);
57 int wn = defuzz(hw->width_minor, fs->hw.width_minor, caps->wfuzz); 57 int wn = defuzz(hw->width_minor, fs->hw.width_minor, caps->abs[BIT_TOUCH_MAJOR].fuzz);
58 fs->id = id; 58 fs->id = id;
59 fs->hw = *hw; 59 fs->hw = *hw;
60 fs->hw.position_x = x; 60 fs->hw.position_x = x;
@@ -65,9 +65,9 @@ static void set_finger(struct FingerState *fs,
65 } 65 }
66 fs->hw.width_major = wj; 66 fs->hw.width_major = wj;
67 fs->hw.width_minor = wn; 67 fs->hw.width_minor = wn;
68 if (!caps->has_touch_minor) 68 if (!caps->has_abs[BIT_TOUCH_MINOR])
69 fs->hw.touch_minor = hw->touch_major; 69 fs->hw.touch_minor = hw->touch_major;
70 if (!caps->has_width_minor) 70 if (!caps->has_abs[BIT_WIDTH_MINOR])
71 fs->hw.width_minor = hw->width_major; 71 fs->hw.width_minor = hw->width_major;
72} 72}
73 73
diff --git a/src/memory.c b/src/memory.c
index 9084502..39621da 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -21,6 +21,9 @@
21 21
22#include "memory.h" 22#include "memory.h"
23 23
24/* click area definition */
25#define CLICK_AREA(c) ((c->has_ibt ? 0.20 : 0.00) * get_cap_ysize(c))
26
24/* fraction of max movement threshold */ 27/* fraction of max movement threshold */
25#define DELTA_CUT(x) (0.5 * (x)) 28#define DELTA_CUT(x) (0.5 * (x))
26 29
@@ -88,11 +91,12 @@ static void update_pointers(struct Memory *m,
88 const struct Capabilities *caps) 91 const struct Capabilities *caps)
89{ 92{
90 const struct MTFinger *f = state->finger; 93 const struct MTFinger *f = state->finger;
94 int yclick = caps->abs[BIT_POSITION_Y].maximum - CLICK_AREA(caps);
91 int i; 95 int i;
92 96
93 if (state->nfinger < 2) { 97 if (state->nfinger < 2) {
94 m->pointing = m->fingers; 98 m->pointing = m->fingers;
95 m->ybar = caps->abs_position_y.maximum; 99 m->ybar = caps->abs[BIT_POSITION_Y].maximum;
96 return; 100 return;
97 } 101 }
98 102
@@ -107,9 +111,9 @@ static void update_pointers(struct Memory *m,
107 } 111 }
108 112
109 m->pointing = 0; 113 m->pointing = 0;
110 m->ybar = caps->yclick; 114 m->ybar = yclick;
111 foreach_bit(i, m->fingers) { 115 foreach_bit(i, m->fingers) {
112 if (f[i].hw.position_y > caps->yclick) 116 if (f[i].hw.position_y > yclick)
113 continue; 117 continue;
114 if (!m->pointing || f[i].hw.position_y > m->ybar) 118 if (!m->pointing || f[i].hw.position_y > m->ybar)
115 m->ybar = f[i].hw.position_y; 119 m->ybar = f[i].hw.position_y;
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) &&