forked from mishurov/linux_elan1200_touchpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrop_releases.diff
57 lines (56 loc) · 2.16 KB
/
drop_releases.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff --git a/src/synaptics.c b/src/synaptics.c
index c7ba9ad..4d98091 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1977,14 +1977,38 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
(abs(hw->y - priv->touch_on.y) >= para->tap_move))));
press = (hw->left || hw->right || hw->middle);
+
+ if (release) {
+ // The artificial releases are followed by the artificial presses
+ // thus I just set a delay and trigger a release if there were
+ // no presses after that, remember a timestamp to hide latency
+ priv->delayed = TRUE;
+ priv->delayed_millis = now;
+ priv->delayed_prevFingers = priv->prevFingers;
+ return 22;
+ }
+
+ if (priv->delayed) {
+ release = (priv->prevFingers == hw->numFingers &&
+ priv->delayed_prevFingers > hw->numFingers);
+ touch = FALSE;
+ if (release) priv->touch_on.millis = priv->delayed_millis;
+ priv->delayed = FALSE;
+ }
+
+
if (touch) {
priv->touch_on.x = hw->x;
priv->touch_on.y = hw->y;
priv->touch_on.millis = now;
}
+ // The timestamp for a release is already set
+ /*
else if (release) {
priv->touch_on.millis = now;
}
+ */
+
if (hw->z > para->finger_high)
if (priv->tap_max_fingers < hw->numFingers)
priv->tap_max_fingers = hw->numFingers;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 33524e5..346999f 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -268,6 +268,9 @@ struct _SynapticsPrivateRec {
} scroll;
int count_packet_finger; /* packet counter with finger on the touchpad */
int button_delay_millis; /* button delay for 3rd button emulation */
+ Bool delayed; /* Is a release delayed */
+ CARD32 delayed_millis; /* Timestamp of delaying a release */
+ int delayed_prevFingers; /* Prev fingers before a delay */
Bool prev_up; /* Previous up button value, for double click emulation */
enum FingerState finger_state; /* previous finger state */
CARD32 last_motion_millis; /* time of the last motion */