summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-02-09 10:57:00 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-14 08:47:05 +1000
commitde75ad6b073c1a36d5a60190de5ffe6611520637 (patch)
treecc7a85fb8d6a12d9592e21d5cd8fc88976f822e4 /src
parent500243ac60ffeb5372e2edbce2f4443a07877d2e (diff)
Enable clickpad click and drag with two fingers
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@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/synaptics.c34
-rw-r--r--src/synapticsstr.h3
2 files changed, 35 insertions, 2 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 7ee0238..7a6d55f 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1722,7 +1722,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;
@@ -1736,6 +1736,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;
@@ -1758,6 +1759,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);
@@ -1781,6 +1786,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);
}
@@ -1835,6 +1844,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) {
@@ -1863,6 +1876,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);
@@ -2872,6 +2896,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 a6e94e3..ecf186f 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 {