[PATCH xf86-input-synaptics 07/12] Enable clickpad click and drag with two fingers
Peter Hutterer
peter.hutterer at who-t.net
Wed Feb 22 22:00:52 PST 2012
On Wed, Feb 22, 2012 at 08:22:40PM -0800, Chase Douglas wrote:
> On 02/22/2012 07:58 PM, Peter Hutterer wrote:
> >On Thu, Feb 09, 2012 at 06:53:01PM -0800, Chase Douglas wrote:
> >>Signed-off-by: Chase Douglas<chase.douglas at canonical.com>
> >>---
> >> src/synaptics.c | 11 +++++++++++
> >> 1 files changed, 11 insertions(+), 0 deletions(-)
> >>
> >>diff --git a/src/synaptics.c b/src/synaptics.c
> >>index 662e060..473ce13 100644
> >>--- a/src/synaptics.c
> >>+++ b/src/synaptics.c
> >>@@ -1889,10 +1889,13 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
> >> hw->left = 0;
> >> break;
> >> case TS_CLICKPAD_MOVE:
> >>+ if (hw->numFingers> 1)
> >>+ hw->numFingers--;
> >> SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now);
> >> if (!hw->left&& !hw->right&& !hw->middle) {
> >> SetMovingState(priv, MS_FALSE, now);
> >> SetTapState(priv, TS_MOVE, now);
> >>+ priv->count_packet_finger = 0;
> >> }
> >> break;
> >> }
> >>@@ -2777,6 +2780,14 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
> >> if (para->touchpad_off == 1)
> >> return delay;
> >>
> >>+ /* If a physical button is pressed on a clickpad, use cumulative touch
> >>+ * movements for motion */
> >>+ if (para->clickpad&& (hw->left || hw->right || hw->middle))
> >>+ {
> >>+ hw->x = hw->cumulative_dx;
> >>+ hw->y = hw->cumulative_dy;
> >>+ }
> >>+
> >
> >help me out here: hw->x is absolute, but hw->cumulative_dx is relative. how
> >do we deal with this?
>
> It's not the most elegant due to how synaptics passes state around,
> but essentially the cumulative values are always the same as the x
> and y values while one touch is active. Once two or more touches are
> active, the cumulative values get incremented and decremented by the
> relative motion of each touch.
>
> If you tried to follow one of the touches, the first touch would
> need to be followed or the x and y values would need to be warped
> and the synaptics history reset. Then you have to make sure the
> right touch is picked, which may take multiple events to determine
> correctly. This would add latency to a press-and-drag action.
>
> Instead, using the cumulative motion of all touches means we don't
> have to choose a single touch to follow up front. The only time this
> gets wonky is if you move multiple fingers at the same time while
> the clickpad is pressed. I don't know of any use cases for this,
> though, so I'm not too worried about it.
this should almost certainly be in the commit message and in a comment in
the source too.
Cheers,
Peter
More information about the xorg-devel
mailing list