summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-02-21 10:31:42 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2014-04-30 12:53:59 +1000
commitdb920ba696d7870b1b074ae2daff1e93a7296b99 (patch)
tree0a6543bdaf8af3f1d46039ad34359324bb0a9a5c /src
parent6d6bfcbf8763d967b8f3805cfe035324aba53e77 (diff)
Ignore motion the first X ms after a clickpad click
This fixes my #1 anoyance with clickpads, where 2 out of 3 clicks turn into a click + drag unless I hold my finger really really still. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Replaced property with a hardcoded 100ms. This is not something that we should expose as property, we should find a delay that works best and live with it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 71652fe1f0800b081ba5602e9edda22a8d8d628e)
Diffstat (limited to 'src')
-rw-r--r--src/synaptics.c12
-rw-r--r--src/synapticsstr.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 9e151db..505e0f7 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -675,6 +675,7 @@ set_default_parameters(InputInfoPtr pInfo)
pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180);
pars->click_time = xf86SetIntOption(opts, "ClickTime", 100);
pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad); /* Probed */
+ pars->clickpad_ignore_motion_time = 100; /* ms */
/* middle mouse button emulation on a clickpad? nah, you're joking */
middle_button_timeout = pars->clickpad ? 0 : 75;
pars->emulate_mid_button_time =
@@ -1031,6 +1032,7 @@ SynapticsReset(SynapticsPrivate * priv)
priv->count_packet_finger = 0;
priv->finger_state = FS_UNTOUCHED;
priv->last_motion_millis = 0;
+ priv->clickpad_click_millis = 0;
priv->inside_button_area = FALSE;
priv->tap_state = TS_START;
priv->tap_button = 0;
@@ -2795,6 +2797,7 @@ update_hw_button_state(const InputInfoPtr pInfo, struct SynapticsHwState *hw,
hw->left = 0;
hw->middle = 1;
}
+ priv->clickpad_click_millis = now;
}
else if (hw->left) {
hw->left = (priv->lastButtons & 1) ? 1 : 0;
@@ -3116,6 +3119,15 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
if (priv->has_scrollbuttons)
double_click = adjust_state_from_scrollbuttons(pInfo, hw);
+ /* Ignore motion the first X ms after a clickpad click */
+ if (priv->clickpad_click_millis) {
+ if(TIME_DIFF(priv->clickpad_click_millis +
+ para->clickpad_ignore_motion_time, now) > 0)
+ ignore_motion = TRUE;
+ else
+ priv->clickpad_click_millis = 0;
+ }
+
/* now we know that these _coordinates_ aren't in the area.
invalid are: x, y, z, numFingers, fingerWidth
valid are: millis, left/right/middle/up/down/etc.
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index aa4b46b..894cef0 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -159,6 +159,7 @@ typedef struct _SynapticsParameters {
int tap_time_2; /* max. tapping time for double taps */
int click_time; /* The duration of a single click */
Bool clickpad; /* Device is a has integrated buttons */
+ int clickpad_ignore_motion_time; /* Ignore motion for X ms after a click */
int emulate_mid_button_time; /* Max time between left and right button presses to
emulate a middle button press. */
int emulate_twofinger_z; /* pressure threshold to emulate two finger touch (for Alps) */
@@ -248,6 +249,7 @@ struct _SynapticsPrivateRec {
enum FingerState finger_state; /* previous finger state */
CARD32 last_motion_millis; /* time of the last motion */
Bool inside_button_area; /* Inside button area (ignore motion) */
+ int clickpad_click_millis; /* Time of last clickpad click */
enum TapState tap_state; /* State of tap processing */
int tap_max_fingers; /* Max number of fingers seen since entering start state */