From 37d34f0356cc556dd8a49ec5d1ed64d49417a9b2 Mon Sep 17 00:00:00 2001 From: Gabriele Mazzotta Date: Thu, 15 Jan 2015 22:04:17 +0100 Subject: Add a delay between the second button down-up event of double taps Some applications ignore the second tap of double taps because of the lack of a delay between the button down and button up events. Prevent this by replacing the transition from TS_2B to TS_START with a transition from TS_2B to TS_SINGLETAP that emits only a button down event. The button up event will be emitted when transitioning from TS_SINGLETAP to TS_START. In addition, decrease the default value of MaxDoubleTapTime from 180 ms to 100 ms in order to make double taps faster. Signed-off-by: Gabriele Mazzotta Signed-off-by: Peter Hutterer --- docs/tapndrag.dia | 171 ++++++++++++++++++++++++++--------------------------- src/synaptics.c | 27 ++------- src/synapticsstr.h | 1 - 3 files changed, 90 insertions(+), 109 deletions(-) diff --git a/docs/tapndrag.dia b/docs/tapndrag.dia index e899e7d..c8ec9d7 100644 --- a/docs/tapndrag.dia +++ b/docs/tapndrag.dia @@ -458,7 +458,7 @@ - + @@ -577,37 +577,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -638,7 +607,7 @@ - + @@ -700,7 +669,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -733,7 +702,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -767,7 +736,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -800,7 +769,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -828,7 +797,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -861,7 +830,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -895,7 +864,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -928,7 +897,7 @@ TDG: Tap-and-drag gesture enabled# - + @@ -962,18 +931,18 @@ and TDG# - + - + - + #TO3 -[D,U]# +[D]# @@ -982,7 +951,7 @@ and TDG# - + @@ -996,7 +965,7 @@ and TDG# - + @@ -1030,7 +999,7 @@ and TDG# - + @@ -1087,7 +1056,7 @@ and TDG# - + @@ -1144,7 +1113,7 @@ and TDG# - + @@ -1169,10 +1138,10 @@ and TDG# - + - + @@ -1196,11 +1165,11 @@ and TDG# - - + + - + @@ -1233,7 +1202,7 @@ and TDG# - + @@ -1266,7 +1235,7 @@ and TDG# - + @@ -1301,7 +1270,7 @@ M# - + @@ -1328,11 +1297,11 @@ M# - + - + @@ -1359,11 +1328,11 @@ M# - + - + @@ -1397,7 +1366,7 @@ M# - + @@ -1454,7 +1423,7 @@ M# - + @@ -1512,12 +1481,12 @@ Tap# - + - + - + @@ -1532,7 +1501,7 @@ Tap# - + @@ -1546,7 +1515,7 @@ Tap# - + @@ -1570,11 +1539,11 @@ Tap# - + - + @@ -1608,7 +1577,7 @@ Tap# - + @@ -1632,11 +1601,11 @@ Tap# - + - + @@ -1670,7 +1639,7 @@ Tap# - + @@ -1694,11 +1663,11 @@ Tap# - + - + @@ -1732,16 +1701,16 @@ Tap# - + - + - + @@ -1756,11 +1725,11 @@ Tap# - - + + - + @@ -1787,11 +1756,11 @@ Tap# - + - + @@ -1824,7 +1793,7 @@ Tap# - + @@ -1855,7 +1824,7 @@ Tap# - + @@ -1890,5 +1859,33 @@ and !TDG + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/synaptics.c b/src/synaptics.c index 0f0b5b9..07b012f 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -671,7 +671,7 @@ set_default_parameters(InputInfoPtr pInfo) pars->finger_high = xf86SetIntOption(opts, "FingerHigh", fingerHigh); pars->tap_time = xf86SetIntOption(opts, "MaxTapTime", 180); pars->tap_move = xf86SetIntOption(opts, "MaxTapMove", tapMove); - pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180); + pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 100); pars->click_time = xf86SetIntOption(opts, "ClickTime", 100); pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad); /* Probed */ if (pars->clickpad) @@ -2073,13 +2073,10 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw, SetTapState(priv, TS_SINGLETAP, now); break; case TS_2B: - if (touch) { + if (touch) SetTapState(priv, TS_3, now); - } - else if (is_timeout) { - SetTapState(priv, TS_START, now); - priv->tap_button_state = TBS_BUTTON_DOWN_UP; - } + else if (is_timeout) + SetTapState(priv, TS_SINGLETAP, now); break; case TS_SINGLETAP: if (touch) @@ -3286,20 +3283,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, (hw->down ? 0x10 : 0) | (hw->multi[2] ? 0x20 : 0) | (hw->multi[3] ? 0x40 : 0)); - if (priv->tap_button > 0) { - int tap_mask = 1 << (priv->tap_button - 1); - - if (priv->tap_button_state == TBS_BUTTON_DOWN_UP) { - if (tap_mask != (priv->lastButtons & tap_mask)) { - xf86PostButtonEvent(pInfo->dev, FALSE, priv->tap_button, TRUE, - 0, 0); - priv->lastButtons |= tap_mask; - } - priv->tap_button_state = TBS_BUTTON_UP; - } - if (priv->tap_button_state == TBS_BUTTON_DOWN) - buttons |= tap_mask; - } + if (priv->tap_button > 0 && priv->tap_button_state == TBS_BUTTON_DOWN) + buttons |= 1 << (priv->tap_button - 1); /* Post events */ if (finger >= FS_TOUCHED && (dx || dy) && !ignore_motion) diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 0bc276d..91c41fc 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -137,7 +137,6 @@ enum TapState { enum TapButtonState { TBS_BUTTON_UP, /* "Virtual tap button" is up */ TBS_BUTTON_DOWN, /* "Virtual tap button" is down */ - TBS_BUTTON_DOWN_UP /* Send button down event + set up state */ }; enum TouchpadModel { -- cgit v1.2.3