Merge lp:~vanvugt/compiz-core/tapping-panacea into lp:compiz-core

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: 3050
Merged at revision: 3050
Proposed branch: lp:~vanvugt/compiz-core/tapping-panacea
Merge into: lp:compiz-core
Diff against target: 99 lines (+16/-20)
4 files modified
metadata/core.xml.in (+0/-7)
src/event.cpp (+1/-8)
src/privatescreen.h (+0/-3)
src/screen.cpp (+15/-2)
To merge this branch: bzr merge lp:~vanvugt/compiz-core/tapping-panacea
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+96726@code.launchpad.net

Description of the change

Reliable tap detection without compromise (!)

Eliminated the timing hack. Instead use individual passive grabs on
<modifier>+each_key to detect whether <modifier> is being tapped, or used
to modify another key.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Looks sound, & I trust Didier's testing.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'metadata/core.xml.in'
2--- metadata/core.xml.in 2012-03-07 09:31:30 +0000
3+++ metadata/core.xml.in 2012-03-09 08:26:32 +0000
4@@ -31,13 +31,6 @@
5 <min>0</min>
6 <max>10000</max>
7 </option>
8- <option name="tap_time" type="int">
9- <_short>Key Tap Time</_short>
10- <_long>Maximim amount of time (milliseconds) a key may be held down and still be reported as a "tap".</_long>
11- <default>150</default>
12- <min>0</min>
13- <max>10000</max>
14- </option>
15 <option name="ping_delay" type="int">
16 <_short>Ping Delay</_short>
17 <_long>Interval between ping messages</_long>
18
19=== modified file 'src/event.cpp'
20--- src/event.cpp 2012-03-08 17:42:06 +0000
21+++ src/event.cpp 2012-03-09 08:26:32 +0000
22@@ -128,9 +128,6 @@
23
24 *action = &option.value ().action ();
25
26- if (*action && !(*action)->active ())
27- return false;
28-
29 return true;
30 }
31
32@@ -146,7 +143,6 @@
33 if (grabbed)
34 {
35 possibleTap = action;
36- tapStart = arguments[7].value ().i ();
37 }
38 else
39 {
40@@ -184,10 +180,7 @@
41 {
42 if (action == possibleTap)
43 {
44- int releaseTime = arguments[7].value ().i ();
45- int tapDuration = releaseTime - tapStart;
46- if (tapDuration < optionGetTapTime ())
47- state |= CompAction::StateTermTapped;
48+ state |= CompAction::StateTermTapped;
49 possibleTap = NULL;
50 }
51
52
53=== modified file 'src/privatescreen.h'
54--- src/privatescreen.h 2012-03-08 17:42:06 +0000
55+++ src/privatescreen.h 2012-03-09 08:26:32 +0000
56@@ -572,9 +572,6 @@
57 private:
58 CompOption::Value plugin;
59 bool dirtyPluginList;
60-
61- protected:
62- Time tapStart;
63 };
64
65 class GrabList
66
67=== modified file 'src/screen.cpp'
68--- src/screen.cpp 2012-03-08 17:42:06 +0000
69+++ src/screen.cpp 2012-03-09 08:26:32 +0000
70@@ -3143,6 +3143,20 @@
71 }
72 }
73 }
74+
75+ /*
76+ * keycode == 0, so this is a modifier-only keybinding.
77+ * Until now I have been trying to:
78+ * grabUngrabOneKey (modifiers | ignore, AnyKey, grab);
79+ * which does not seem to work at all.
80+ * However, binding to each keycode individually does work.
81+ * This is so that we can detect taps on individual modifier
82+ * keys, and know to cancel the tap if <modifier>+k is pressed.
83+ */
84+ int minCode, maxCode;
85+ XDisplayKeycodes (dpy, &minCode, &maxCode);
86+ for (k = minCode; k <= maxCode; k++)
87+ grabUngrabOneKey (modifiers | ignore, k, grab);
88 }
89
90 if (CompScreen::checkForError (dpy))
91@@ -5042,8 +5056,7 @@
92 ScreenUser (screen),
93 CoreOptions (false),
94 plugin (),
95- dirtyPluginList (true),
96- tapStart (0)
97+ dirtyPluginList (true)
98 {
99 }
100

Subscribers

People subscribed via source and target branches