diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-04-18 16:22:56 +0200 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2010-04-18 16:27:52 +0200 |
commit | ffe299eaea8a7295228701205c9286cc66e9ab0f (patch) | |
tree | 6e95543ab828376f1e418e03e8508dbf987faaed | |
parent | 182d9419ded03262166514e3c76033a8daa14141 (diff) | |
download | xorg-input-kobomultitouch-ffe299eaea8a7295228701205c9286cc66e9ab0f.tar.gz xorg-input-kobomultitouch-ffe299eaea8a7295228701205c9286cc66e9ab0f.tar.bz2 xorg-input-kobomultitouch-ffe299eaea8a7295228701205c9286cc66e9ab0f.zip |
Hold MT data during pure button events
Some devices send button events through a separate device, causing the
driver to temporarily lose the MT state. As a result, spurious button
events are emitted in conjunction with multi-finger clicks.
This patch makes sure that the MT state is updated only after
receiving MT data, restoring click normality.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r-- | src/hwdata.c | 8 | ||||
-rw-r--r-- | src/hwdata.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/hwdata.c b/src/hwdata.c index 9ec6241..689418e 100644 --- a/src/hwdata.c +++ b/src/hwdata.c @@ -32,6 +32,7 @@ static void set_value(struct HWData *hw, int code, int value) (&hw->finger[hw->nread].touch_major)[code] = value; SETBIT(hw->mread[hw->nread], code); } + hw->mtread++; } static void accept_finger(struct HWData *hw) @@ -49,7 +50,9 @@ static void accept_finger(struct HWData *hw) static void accept_packet(struct HWData *hw, const struct timeval* tv) { static const mstime_t ms = 1000; - hw->nfinger = hw->nread; + if (hw->mtread) + hw->nfinger = hw->nread; + hw->mtread = 0; hw->nread = 0; hw->mread[hw->nread] = 0; hw->evtime = tv->tv_usec / ms + tv->tv_sec * ms; @@ -70,6 +73,9 @@ int read_hwdata(struct HWData *hw, const struct input_event* ev) break; case EV_KEY: switch (ev->code) { + case BTN_TOUCH: + hw->mtread++; + break; case BTN_LEFT: if (ev->value) SETBIT(hw->button, MT_BUTTON_LEFT); diff --git a/src/hwdata.h b/src/hwdata.h index 81d847b..15a9fcb 100644 --- a/src/hwdata.h +++ b/src/hwdata.h @@ -73,7 +73,7 @@ struct HWData { struct FingerData finger[DIM_FINGER]; unsigned mask[DIM_FINGER], mread[DIM_FINGER]; unsigned button; - int nfinger, nread; + int nfinger, mtread, nread; mstime_t evtime; }; |