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
1=== modified file 'src/event.cpp'
2--- src/event.cpp 2012-02-22 05:13:00 +0000
3+++ src/event.cpp 2012-03-02 08:41:19 +0000
4@@ -128,6 +128,9 @@
5
6 *action = &option.value ().action ();
7
8+ if (action && !(*action)->active ())
9+ return false;
10+
11 return true;
12 }
13
14@@ -136,16 +139,18 @@
15 CompAction::State state,
16 CompOption::Vector &arguments)
17 {
18+ bool actionEventHandled = false;
19+
20 if (state == CompAction::StateInitKey &&
21 grabs.empty () &&
22 !action->terminate ().empty ())
23 {
24 possibleTap = action;
25 int err = XGrabKeyboard (dpy, grabWindow, True,
26- GrabModeAsync, GrabModeSync, CurrentTime);
27+ GrabModeAsync, GrabModeSync, arguments[7].value ().i ());
28 if (err == GrabSuccess)
29 {
30- XAllowEvents (dpy, SyncKeyboard, CurrentTime);
31+ XAllowEvents (dpy, SyncKeyboard, CurrentTime);
32 tapGrab = true;
33 }
34 }
35@@ -158,9 +163,9 @@
36 action->setState (action->state () | CompAction::StateTermKey);
37 }
38 else if (action->initiate () (action, state, arguments))
39- return true;
40+ actionEventHandled = true;
41
42- return false;
43+ return actionEventHandled;
44 }
45
46 bool
47@@ -1050,8 +1055,11 @@
48 * Critical event handling that cannot be overridden by plugins
49 */
50
51- if (priv->tapGrab &&
52- (event->type == KeyPress || event->type == KeyRelease))
53+ bool keyEvent = (event->type == KeyPress || event->type == KeyRelease);
54+
55+ /* Always either replay the keyboard or consume the key
56+ * event on keypresses */
57+ if (keyEvent)
58 {
59 int mode = priv->eventHandled ? AsyncKeyboard : ReplayKeyboard;
60 XAllowEvents (priv->dpy, mode, event->xkey.time);
61@@ -1062,6 +1070,8 @@
62 XUngrabKeyboard (priv->dpy, event->xkey.time);
63 priv->tapGrab = false;
64 }
65+
66+ XFlush (priv->dpy);
67 }
68
69 void

Subscribers

People subscribed via source and target branches