Merge lp:~vanvugt/compiz-core/fix-806255 into lp:compiz-core

Proposed by Daniel van Vugt
Status: Merged
Merged at revision: 3045
Proposed branch: lp:~vanvugt/compiz-core/fix-806255
Merge into: lp:compiz-core
Diff against target: 49 lines (+12/-6)
1 file modified
src/event.cpp (+12/-6)
To merge this branch: bzr merge lp:~vanvugt/compiz-core/fix-806255
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+96095@code.launchpad.net

Description of the change

Don't respond to hotkeys if some other window (like a VM or locked
screen saver) already has an active keyboard grab. (LP: #806255)

Also fixed a minor pointer mistake in isBound(), and removed a redundant
call to XFlush.

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

The real question is: Why does compiz still receive key events while other apps have the keyboard fully grabbed? I'm not entirely sure, but it only seems to happen with modifier-only hotkeys. As such, it's possibly caused by listening to xkbEvent. So it's possible a better long-term solution would be to rewrite modifier-only key handling without using xkbEvent. Not sure.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Looks sane, seems to work.

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-03-05 09:04:16 +0000
3+++ src/event.cpp 2012-03-06 11:13:21 +0000
4@@ -128,7 +128,7 @@
5
6 *action = &option.value ().action ();
7
8- if (action && !(*action)->active ())
9+ if (*action && !(*action)->active ())
10 return false;
11
12 return true;
13@@ -141,9 +141,7 @@
14 {
15 bool actionEventHandled = false;
16
17- if (state == CompAction::StateInitKey &&
18- grabs.empty () &&
19- !action->terminate ().empty ())
20+ if (state == CompAction::StateInitKey && grabs.empty ())
21 {
22 possibleTap = action;
23 int err = XGrabKeyboard (dpy, grabWindow, True,
24@@ -153,6 +151,16 @@
25 XAllowEvents (dpy, SyncKeyboard, CurrentTime);
26 tapGrab = true;
27 }
28+ else
29+ {
30+ possibleTap = NULL;
31+ /*
32+ * Don't trigger any compiz actions if some other app has the
33+ * keyboard grabbed (like a VM or locked screensaver). LP: #806255
34+ */
35+ if (err == AlreadyGrabbed)
36+ return false;
37+ }
38 }
39
40 if (action->initiate ().empty () && !action->terminate ().empty ())
41@@ -1070,8 +1078,6 @@
42 XUngrabKeyboard (priv->dpy, event->xkey.time);
43 priv->tapGrab = false;
44 }
45-
46- XFlush (priv->dpy);
47 }
48
49 void

Subscribers

People subscribed via source and target branches