[PATCH xf86-input-synaptics v3 05/10] Enable clickpad click and drag with two fingers
Chase Douglas
chase.douglas at canonical.com
Thu Feb 23 13:02:20 PST 2012
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.douglas at 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 e90ec9e..c63937d 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1692,7 +1692,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;
@@ -1706,6 +1706,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;
@@ -1728,6 +1729,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);
@@ -1751,6 +1756,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);
}
@@ -1805,6 +1814,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) {
@@ -1833,6 +1846,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);
@@ -2754,6 +2778,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
More information about the xorg-devel
mailing list