Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(Synaptics) Using SingleTapTimeout=0 but also can TapAndDrag
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
nafsaka
n00b
n00b


Joined: 16 Dec 2012
Posts: 5

PostPosted: Sun Mar 30, 2014 1:57 pm    Post subject: (Synaptics) Using SingleTapTimeout=0 but also can TapAndDrag Reply with quote

Hello, Gentooers
Assalamualaikum
Shalom
Salam

Lately, i've been searching how to enable FastTap (now it removed, the same effect can be achieved bysetting SingleTapTimeout=0) but also can use the TapAndDragGesture.
At first i thought it is an easy task. Eventually i can "fix" this in one whole day (Phew, take some time to solve this beast).

In summary, you can't make SingleTapTimeout=0 and TapAndDragGesture in the same time, because it contradict each other (in synaptics module).
If you use SingleTapTimeout=0 then you can't detect the touch-release-touch event that characterize TapAndDragGesture. If we use SingleTapTimeout=180 (as default), it is annoying delayed.

I'm facing this problem, because my new laptop is a clickpad (asus x450j). So the button is below the touchpad. I can't use click to TapAndDrag "easily" (In fact it is very hard to use the button).
So i'm forced to solve this problem. I share this post, so that "me in the future" or someone else who is struggle with the same problem, can read my post as a reference.

We must change the code to make it happen (some other opinion?). I minimalize the change as much as possible (to make it portable and easy to applied).

Currently i use Synaptics 1.7.3

Code for detection tap is in the synaptics.c -> HandleTapProcessing.

Add a variable:
Code:
static CARD32 lasttap = 0;


Modify TS_START so it looked like this:
Code:
    case TS_START:
        if (touch) {
         if ((uint)TIME_DIFF(priv->touch_on.millis, lasttap) < para->tap_time) {
            SetTapState(priv, TS_3, now);
            goto restart;
         }
            SetTapState(priv, TS_1, now);
      }
        break;


Modify TS_2A so it looked like this:
Code:
    case TS_2A:
        if (touch) {
            SetTapState(priv, TS_3, now);
        }
        else if (is_timeout) {
            SetTapState(priv, TS_SINGLETAP, now);
         lasttap = priv->touch_on.millis;
        }
        break;


Then you're done. The idea is to detect the second click whether it is a TapAndDrag or not.
The minus is, when you use TapAndDrag, the part that you want to select will be initially one block (because the click-release-click behave like a double click and drag)

(Optional) This is my synaptic configuration:
Code:
Section "InputClass"
   Identifier "touchpad"
   Driver "synaptics"
   MatchIsTouchpad "on"
   Option "HorizTwoFingerScroll" "on"
   Option "PalmDetect" "on"
   Option "PalmMinWidth" "5"
   Option "HorizScrollDelta" "10"
   Option "TapButton1" "1"
   Option "TapButton2" "3"
   Option "TapButton3" "2"
   Option "ClickFinger2" "0"
   Option "ClickFinger3" "0"
   Option "MinSpeed" "0.5"
   Option "MaxSpeed" "20"
   Option "AccelFactor" "0.075"
   Option "SingleTapTimeout" "0"
   Option "CoastingSpeed" "10"
   Option "CoastingFriction" "1"
   Option "VertHysteresis" "10"
   Option "HorizHysteresis" "10"
   Option "TapAndDragGesture" "1"
   Option "FingerLow" "1"
   Option "FingerHigh" "15"
   Option "ClickTime" "0"
   Option "LockedDrags" "0"
   Option "PalmMinz" "15"
   Option "MaxTapMove" "700"
EndSection

_________________
There is only one God.


Last edited by nafsaka on Mon Apr 21, 2014 5:21 pm; edited 3 times in total
Back to top
View user's profile Send private message
nafsaka
n00b
n00b


Joined: 16 Dec 2012
Posts: 5

PostPosted: Sat Apr 05, 2014 3:00 am    Post subject: Update (Another method) Reply with quote

Default from synaptic:
Pro: Double Tap start instantly, Tap And Drag should start instantly ( i don't know why in my case it feel laggy, even in the code it should be instantly )
Contra: Single Tap must wait at SingleTapTimeout microsecond.

The method that i describe is using double tap to start the tapanddrag.
Pro: Single Tap start instantly, Double Tap start instantly, Tap And Drag start instantly
Contra: Tap and Drag behave like double clik and drag (it is selection by block).

Now i'm going to introduce the third method which is simpler than the second method i mentioned.
Pro: Single Tap start instantly, Double Tap start instantly, Tap And Drag behave like single click and drag.
Contra: Tap and Drag must wait at MaxTapTime microsecond (for detection).

For the three method i'll chose the second one as my daily use. Because i prefer the instantious than lagging one (even for that i must give up the behaviour of single click and drag)

For the third method you just insert two line in TS_1:

Code:
    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);
            goto restart;
        }
        else if (is_timeout) {
            if (finger == FS_TOUCHED) {
      SetTapState(priv, TS_3, now);    // <-- HERE
      goto restart;                                 // <-- HERE
                SetMovingState(priv, MS_TOUCHPAD_RELATIVE, now);
            }
            SetTapState(priv, TS_MOVE, now);
            goto restart;
        }
        else if (release) {
            edge = edge_detection(priv, priv->touch_on.x, priv->touch_on.y);
            SelectTapButton(priv, edge);
            /* Disable taps outside of the active area */
            if (!inside_active_area) {
                priv->tap_button = 0;
            }
            SetTapState(priv, TS_2A, now);
        }


Don't forget to set the MaxTapTimeout (ex: synclient MaxTapTimeout=500)
_________________
There is only one God.
Back to top
View user's profile Send private message
nafsaka
n00b
n00b


Joined: 16 Dec 2012
Posts: 5

PostPosted: Sat Apr 05, 2014 4:07 am    Post subject: No acceleration in Scrolling Reply with quote

I feel the scrolling (with two finger) doesn't have any acceleration just like acceleration in moving the pointer. So i peek a little into the code, and yes there is no mechanism of acceleration in the scrolling (too bad). So i give up in this, i'm gonna live with it :)

Thank you for everyone who code this beast synaptics. Your code was very beautiful in my point of view (so that a newbie like me can read it).
_________________
There is only one God.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2452
Location: The Peanut Gallery

PostPosted: Sun Apr 20, 2014 12:24 am    Post subject: Reply with quote

Good work, nafsaka.

Not using synaptics atm but will be when I reinstall a laptop, so I'll check this out then. It's always good to see someone getting into the code, though.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum