summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-04-18 09:10:36 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-04-18 09:58:49 +0200
commit182d9419ded03262166514e3c76033a8daa14141 (patch)
tree3265ebe907591793ee73c0186be3e0d810716722 /src
parent923754e3b864c33e23725435ae5049354a8ac5aa (diff)
Filter non-zero finger width events
Add filtering also to touch/width events, but be careful to treat a zero touch exactly as zero. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src')
-rw-r--r--src/capabilities.c9
-rw-r--r--src/capabilities.h3
-rw-r--r--src/hwstate.c16
3 files changed, 24 insertions, 4 deletions
diff --git a/src/capabilities.c b/src/capabilities.c
index 1f555f9..7f3b34d 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -29,6 +29,7 @@
#define CLICK_AREA(c) ((c->has_ibt ? 0.20 : 0.00) * get_cap_ysize(c))
static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */
+static const int SN_WIDTH = 15; /* width signal-to-noise ratio */
static const int bits_per_long = 8 * sizeof(long);
@@ -103,6 +104,9 @@ int read_capabilities(struct Capabilities *cap, int fd)
cap->xfuzz = get_cap_xsize(cap) / SN_COORD;
cap->yfuzz = get_cap_ysize(cap) / SN_COORD;
}
+ cap->wfuzz = cap->abs_touch_major.fuzz;
+ if (cap->wfuzz <= 0)
+ cap->wfuzz = get_cap_wsize(cap) / SN_WIDTH;
cap->yclick = cap->abs_position_y.maximum - CLICK_AREA(cap);
@@ -119,6 +123,11 @@ int get_cap_ysize(const struct Capabilities *cap)
return cap->abs_position_y.maximum - cap->abs_position_y.minimum;
}
+int get_cap_wsize(const struct Capabilities *cap)
+{
+ return cap->abs_touch_major.maximum - cap->abs_touch_major.minimum;
+}
+
void output_capabilities(const struct Capabilities *cap)
{
char line[1024];
diff --git a/src/capabilities.h b/src/capabilities.h
index af59384..402d297 100644
--- a/src/capabilities.h
+++ b/src/capabilities.h
@@ -40,13 +40,14 @@ struct Capabilities {
struct input_absinfo abs_orientation;
struct input_absinfo abs_position_x;
struct input_absinfo abs_position_y;
- int xfuzz, yfuzz;
+ int xfuzz, yfuzz, wfuzz;
int yclick;
};
int read_capabilities(struct Capabilities *cap, int fd);
int get_cap_xsize(const struct Capabilities *cap);
int get_cap_ysize(const struct Capabilities *cap);
+int get_cap_wsize(const struct Capabilities *cap);
void output_capabilities(const struct Capabilities *cap);
diff --git a/src/hwstate.c b/src/hwstate.c
index d758d25..07bab31 100644
--- a/src/hwstate.c
+++ b/src/hwstate.c
@@ -69,14 +69,24 @@ static void set_finger(struct FingerState *fs,
{
int x = defuzz(hw->position_x, fs->hw.position_x, caps->xfuzz);
int y = defuzz(hw->position_y, fs->hw.position_y, caps->yfuzz);
- fs->hw = *hw;
+ int tj = defuzz(hw->touch_major, fs->hw.touch_major, caps->wfuzz);
+ int tn = defuzz(hw->touch_minor, fs->hw.touch_minor, caps->wfuzz);
+ int wj = defuzz(hw->width_major, fs->hw.width_major, caps->wfuzz);
+ int wn = defuzz(hw->width_minor, fs->hw.width_minor, caps->wfuzz);
fs->id = id;
+ fs->hw = *hw;
+ fs->hw.position_x = x;
+ fs->hw.position_y = y;
+ if (hw->touch_major) {
+ fs->hw.touch_major = tj;
+ fs->hw.touch_minor = tn;
+ }
+ fs->hw.width_major = wj;
+ fs->hw.width_minor = wn;
if (!caps->has_touch_minor)
fs->hw.touch_minor = hw->touch_major;
if (!caps->has_width_minor)
fs->hw.width_minor = hw->width_major;
- fs->hw.position_x = x;
- fs->hw.position_y = y;
}
void modify_hwstate(struct HWState *s,