Unless the motion has started outside the soft-button area. 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 <hdego...@redhat.com> --- src/synaptics.c | 33 ++++++++++++++++++++++++++++++++- src/synapticsstr.h | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/synaptics.c b/src/synaptics.c index 8064844..e06c735 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1027,6 +1027,7 @@ SynapticsReset(SynapticsPrivate * priv) priv->count_packet_finger = 0; priv->finger_state = FS_UNTOUCHED; priv->last_motion_millis = 0; + priv->ignore_motion = FALSE; priv->tap_state = TS_START; priv->tap_button = 0; priv->tap_button_state = TBS_BUTTON_UP; @@ -1487,6 +1488,28 @@ is_inside_topmiddlebutton_area(SynapticsParameters * para, int x, int y) return is_inside_button_area(para, 3, x, y); } +static Bool +is_inside_anybutton_area(SynapticsParameters * para, int x, int y) +{ + enum { + TOP = 2, + BOTTOM = 3 + }; + + /* We don't have a left button area, so we simply check for + * y > bottomrightbuttonarea top or y < toprightbuttonarea bottom, + * assuming that all soft buttons have the same height */ + + if (para->softbutton_areas[0][TOP] && y > para->softbutton_areas[0][TOP]) + return TRUE; + + if (para->softbutton_areas[2][BOTTOM] && + y < para->softbutton_areas[2][BOTTOM]) + return TRUE; + + return FALSE; +} + static CARD32 timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) { @@ -3024,6 +3047,14 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, inside_active_area = is_inside_active_area(priv, hw->x, hw->y); + /* Ignore motion *starting* inside softbuttonareas */ + if (priv->finger_state < FS_TOUCHED) + priv->ignore_motion = is_inside_anybutton_area(para, hw->x, hw->y); + /* If we already have a finger down, clear ignore motion if it goes + outside of the softbuttonareas */ + else if (!is_inside_anybutton_area(para, hw->x, hw->y)) + priv->ignore_motion = FALSE; + /* these two just update hw->left, right, etc. */ update_hw_button_state(pInfo, hw, priv->old_hw_state, now, &delay); if (priv->has_scrollbuttons) @@ -3095,7 +3126,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, } /* Post events */ - if (finger >= FS_TOUCHED && (dx || dy) && + if (finger >= FS_TOUCHED && (dx || dy) && !priv->ignore_motion && (para->touchpad_off != TOUCHPAD_CLICK_ONLY)) xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy); diff --git a/src/synapticsstr.h b/src/synapticsstr.h index dee155f..d2fabdf 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -249,6 +249,7 @@ struct _SynapticsPrivateRec { Bool prev_up; /* Previous up button value, for double click emulation */ enum FingerState finger_state; /* previous finger state */ CARD32 last_motion_millis; /* time of the last motion */ + Bool ignore_motion; /* ignore motion (inside softbutton area) */ enum TapState tap_state; /* State of tap processing */ int tap_max_fingers; /* Max number of fingers seen since entering start state */ -- 1.8.5.3 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel