Use cumulative relative touch motion when the clickpad is pressed. If more than one touch is active, assume one of the touches is designated solely for pressing the clickpad button. Thus, decrement the number of reported touches.
Signed-off-by: Chase Douglas <chase.doug...@canonical.com> --- src/synaptics.c | 34 +++++++++++++++++++++++++++++++++- src/synapticsstr.h | 3 ++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index f1b76ee..cdc45c7 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1700,7 +1700,7 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, Bool inside_active_area) { SynapticsParameters *para = &priv->synpara; - Bool touch, release, is_timeout, move; + Bool touch, release, is_timeout, move, press; int timeleft, timeout; edge_type edge; int delay = 1000000000; @@ -1714,6 +1714,7 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, (priv->tap_max_fingers <= ((priv->horiz_scroll_twofinger_on || priv->vert_scroll_twofinger_on)? 2 : 1)) && ((abs(hw->x - priv->touch_on.x) >= para->tap_move) || (abs(hw->y - priv->touch_on.y) >= para->tap_move))); + press = (hw->left || hw->right || hw->middle); if (touch) { priv->touch_on.x = hw->x; @@ -1736,6 +1737,10 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, SetTapState(priv, TS_1, now); break; case TS_1: + if (para->clickpad && press) { + SetTapState(priv, TS_CLICKPAD_MOVE, now); + goto restart; + } if (move) { SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now); SetTapState(priv, TS_MOVE, now); @@ -1759,6 +1764,10 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, } break; case TS_MOVE: + if (para->clickpad && press) { + SetTapState(priv, TS_CLICKPAD_MOVE, now); + goto restart; + } if (move && priv->moving_state == MS_TRACKSTICK) { SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now); } @@ -1813,6 +1822,10 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, } break; case TS_DRAG: + if (para->clickpad && press) { + SetTapState(priv, TS_CLICKPAD_MOVE, now); + goto restart; + } if (move) SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now); if (release) { @@ -1841,6 +1854,17 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw, SetTapState(priv, TS_START, now); } break; + case TS_CLICKPAD_MOVE: + /* Assume one touch is only for holding the clickpad button down */ + if (hw->numFingers > 1) + hw->numFingers--; + SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now); + if (!press) { + SetMovingState(priv, MS_FALSE, now); + SetTapState(priv, TS_MOVE, now); + priv->count_packet_finger = 0; + } + break; } timeout = GetTimeOut(priv); @@ -2760,6 +2784,14 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, return delay; } + /* If a physical button is pressed on a clickpad, use cumulative relative + * touch movements for motion */ + if (para->clickpad && (hw->left || hw->right || hw->middle)) + { + hw->x = hw->cumulative_dx; + hw->y = hw->cumulative_dy; + } + /* apply hysteresis before doing anything serious. This cancels * out a lot of noise which might surface in strange phenomena * like flicker in scrolling or noise motion. */ diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 8f33b95..bdea96a 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -99,7 +99,8 @@ enum TapState { TS_3, /* After second touch */ TS_DRAG, /* Pointer drag enabled */ TS_4, /* After release when "locked drags" enabled */ - TS_5 /* After touch when "locked drags" enabled */ + TS_5, /* After touch when "locked drags" enabled */ + TS_CLICKPAD_MOVE, /* After left button press on a clickpad */ }; enum TapButtonState { -- 1.7.9 _______________________________________________ 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