Merge lp:~brandontschaefer/compiz/disable-tap-detection into lp:compiz/0.9.9

Proposed by Brandon Schaefer on 2012-10-01
Status: Merged
Approved by: Daniel van Vugt on 2012-10-03
Approved revision: 3408
Merged at revision: 3408
Proposed branch: lp:~brandontschaefer/compiz/disable-tap-detection
Merge into: lp:compiz/0.9.9
Diff against target: 119 lines (+34/-5)
4 files modified
include/core/action.h (+2/-1)
src/privatescreen.h (+4/-0)
src/screen.cpp (+18/-4)
xslt/bcop.xslt (+10/-0)
To merge this branch: bzr merge lp:~brandontschaefer/compiz/disable-tap-detection
Reviewer Review Type Date Requested Status
Daniel van Vugt 2012-10-01 Approve on 2012-10-03
jenkins (community) continuous-integration Needs Fixing on 2012-10-02
Review via email: mp+127370@code.launchpad.net

Commit message

Added a new template that will check tap_detection. If it is false then add
CompAction::StateTapIgnore to the actions state.

If StateTapIgnore is set then in grabUngrabManyKeys ignore grabbing all
modifier+<keys>, because we don't care if the modifier is a tap or not.

This allows for Super+P to work with this unity branch:
https://code.launchpad.net/~brandontschaefer/unity/disable-tap-for-super/+merge/127407

Description of the change

See commit message.

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

We should avoid double negatives because they're confusing to read. So:
            <xsl:when test="./disable_tap_detection/text() = 'true'">
should be:
            <xsl:when test="./enable_tap_detection/text() = 'false'">

review: Needs Fixing
Daniel van Vugt (vanvugt) wrote :

Also, for consistency and clarity DisableTapDetection should be called something else starting with "State..."

Otherwise, it looks good. And tap detection still works as before.

review: Needs Fixing
3408. By Brandon Schaefer on 2012-10-02

* Renamed things

Brandon Schaefer (brandontschaefer) wrote :

Alright, renamed some things :) (Hopefully it is descriptive enough!)

jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

OK, looks good. And I've retested confirming tap detection still works (when you want it).

review: Approve
Michael Terry (mterry) wrote :

I commented in the Unity branch about this too, but I'd like to see a regression test for this. I happened to run into Steve Magoun in Lexington, and he mentioned that this bug had regressed more than once.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/action.h'
2--- include/core/action.h 2012-09-07 22:37:20 +0000
3+++ include/core/action.h 2012-10-02 16:31:20 +0000
4@@ -75,7 +75,8 @@
5 StateCancel = 1 << 10,
6 StateAutoGrab = 1 << 11,
7 StateNoEdgeDelay = 1 << 12,
8- StateTermTapped = 1 << 13
9+ StateTermTapped = 1 << 13,
10+ StateIgnoreTap = 1 << 14
11 } StateEnum;
12
13 /**
14
15=== modified file 'src/privatescreen.h'
16--- src/privatescreen.h 2012-06-24 09:00:27 +0000
17+++ src/privatescreen.h 2012-10-02 16:31:20 +0000
18@@ -427,8 +427,12 @@
19 void updatePassiveKeyGrabs ();
20 void updatePassiveButtonGrabs(Window serverFrame);
21
22+ void setCurrentState(CompAction::State state);
23+
24 private:
25 CompScreen * const screen;
26+ CompAction::State currentState;
27+
28 std::list<ButtonGrab> buttonGrabs;
29 std::list<KeyGrab> keyGrabs;
30 };
31
32=== modified file 'src/screen.cpp'
33--- src/screen.cpp 2012-09-18 01:44:23 +0000
34+++ src/screen.cpp 2012-10-02 16:31:20 +0000
35@@ -3349,10 +3349,13 @@
36 * This is so that we can detect taps on individual modifier
37 * keys, and know to cancel the tap if <modifier>+k is pressed.
38 */
39- int minCode, maxCode;
40- XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);
41- for (k = minCode; k <= maxCode; k++)
42- grabUngrabOneKey (modifiers | ignore, k, grab);
43+ if (!(currentState & CompAction::StateIgnoreTap))
44+ {
45+ int minCode, maxCode;
46+ XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);
47+ for (k = minCode; k <= maxCode; k++)
48+ grabUngrabOneKey (modifiers | ignore, k, grab);
49+ }
50 }
51
52 if (CompScreen::checkForError (screen->dpy()))
53@@ -3529,6 +3532,12 @@
54 }
55 }
56
57+void
58+cps::GrabManager::setCurrentState (CompAction::State state)
59+{
60+ currentState = state;
61+}
62+
63 bool
64 CompScreenImpl::addAction (CompAction *action)
65 {
66@@ -3539,6 +3548,8 @@
67 if (action->active ())
68 return false;
69
70+ grabManager.setCurrentState(action->state());
71+
72 if (action->type () & CompAction::BindingTypeKey)
73 {
74 if (!grabManager.addPassiveKeyGrab (action->key ()))
75@@ -3579,6 +3590,8 @@
76 if (!action->active ())
77 return;
78
79+ grabManager.setCurrentState(action->state());
80+
81 if (action->type () & CompAction::BindingTypeKey)
82 grabManager.removePassiveKeyGrab (action->key ());
83
84@@ -5385,6 +5398,7 @@
85
86 cps::GrabManager::GrabManager (CompScreen *screen) :
87 screen(screen),
88+ currentState(0),
89 buttonGrabs (),
90 keyGrabs ()
91 {
92
93=== modified file 'xslt/bcop.xslt'
94--- xslt/bcop.xslt 2012-05-18 06:52:20 +0000
95+++ xslt/bcop.xslt 2012-10-02 16:31:20 +0000
96@@ -475,6 +475,7 @@
97 </xsl:text>
98 <xsl:text> action.setState (state | CompAction::StateInitKey);
99 </xsl:text>
100+ <xsl:call-template name="initTapDetection"/>
101 <xsl:if test="default/text() and default/text() != 'disabled'">
102 <xsl:text> action.keyFromString ("</xsl:text>
103 <xsl:value-of select="default/text()"/>
104@@ -735,6 +736,15 @@
105 </xsl:if>
106 </xsl:template>
107
108+ <xsl:template name="initTapDetection">
109+ <xsl:choose>
110+ <xsl:when test="./tap_detection/text() = 'false'">
111+ <xsl:text> action.setState (action.state() | CompAction::StateIgnoreTap);
112+</xsl:text>
113+ </xsl:when>
114+ </xsl:choose>
115+ </xsl:template>
116+
117 <xsl:template name="initIntRestriction">
118 <xsl:param name="value"/>
119 <xsl:value-of select="$value"/>

Subscribers

People subscribed via source and target branches