Merge lp:~smspillaz/compiz-core/compiz-core.fix_944631 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 3038
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_944631
Merge into: lp:compiz-core
Diff against target: 69 lines (+16/-6)
1 file modified
src/event.cpp (+16/-6)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_944631
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Review via email: mp+95517@code.launchpad.net

Description of the change

== Problem ==

Pressing alt-left-right would trigger alt-tab

== Solution ==

Don't trigger keybindings which aren't active

== Tests ==

None yet.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think this is actually bug 943612.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I will test this on the weekend or Monday.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Tests OK.

I note however:
1. A tab change on line 31.
2. I'm not convinced that chunk @@ -1050,8 +1055,11 @@ is necessary.
3. I'm fairly sure that chunk @@ -1062,6 +1070,8 @@ is redundant because XFlush is already called as soon as alwaysHandleEvent returns.

But these are not blocking issues.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/event.cpp'
--- src/event.cpp 2012-02-22 05:13:00 +0000
+++ src/event.cpp 2012-03-02 08:41:19 +0000
@@ -128,6 +128,9 @@
128128
129 *action = &option.value ().action ();129 *action = &option.value ().action ();
130130
131 if (action && !(*action)->active ())
132 return false;
133
131 return true;134 return true;
132}135}
133136
@@ -136,16 +139,18 @@
136 CompAction::State state,139 CompAction::State state,
137 CompOption::Vector &arguments)140 CompOption::Vector &arguments)
138{141{
142 bool actionEventHandled = false;
143
139 if (state == CompAction::StateInitKey &&144 if (state == CompAction::StateInitKey &&
140 grabs.empty () &&145 grabs.empty () &&
141 !action->terminate ().empty ())146 !action->terminate ().empty ())
142 {147 {
143 possibleTap = action;148 possibleTap = action;
144 int err = XGrabKeyboard (dpy, grabWindow, True,149 int err = XGrabKeyboard (dpy, grabWindow, True,
145 GrabModeAsync, GrabModeSync, CurrentTime);150 GrabModeAsync, GrabModeSync, arguments[7].value ().i ());
146 if (err == GrabSuccess)151 if (err == GrabSuccess)
147 {152 {
148 XAllowEvents (dpy, SyncKeyboard, CurrentTime);153 XAllowEvents (dpy, SyncKeyboard, CurrentTime);
149 tapGrab = true;154 tapGrab = true;
150 }155 }
151 }156 }
@@ -158,9 +163,9 @@
158 action->setState (action->state () | CompAction::StateTermKey);163 action->setState (action->state () | CompAction::StateTermKey);
159 }164 }
160 else if (action->initiate () (action, state, arguments))165 else if (action->initiate () (action, state, arguments))
161 return true;166 actionEventHandled = true;
162167
163 return false;168 return actionEventHandled;
164}169}
165170
166bool171bool
@@ -1050,8 +1055,11 @@
1050 * Critical event handling that cannot be overridden by plugins1055 * Critical event handling that cannot be overridden by plugins
1051 */1056 */
10521057
1053 if (priv->tapGrab &&1058 bool keyEvent = (event->type == KeyPress || event->type == KeyRelease);
1054 (event->type == KeyPress || event->type == KeyRelease))1059
1060 /* Always either replay the keyboard or consume the key
1061 * event on keypresses */
1062 if (keyEvent)
1055 {1063 {
1056 int mode = priv->eventHandled ? AsyncKeyboard : ReplayKeyboard;1064 int mode = priv->eventHandled ? AsyncKeyboard : ReplayKeyboard;
1057 XAllowEvents (priv->dpy, mode, event->xkey.time);1065 XAllowEvents (priv->dpy, mode, event->xkey.time);
@@ -1062,6 +1070,8 @@
1062 XUngrabKeyboard (priv->dpy, event->xkey.time);1070 XUngrabKeyboard (priv->dpy, event->xkey.time);
1063 priv->tapGrab = false;1071 priv->tapGrab = false;
1064 }1072 }
1073
1074 XFlush (priv->dpy);
1065}1075}
10661076
1067void1077void

Subscribers

People subscribed via source and target branches