From: Chase Douglas <chase.doug...@canonical.com>

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>
Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 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 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 {
-- 
1.7.7.6

_______________________________________________
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

Reply via email to