Merge lp:~vanvugt/compiz-core/fix-alt-bugs-2 into lp:compiz-core

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: 3047
Merged at revision: 3048
Proposed branch: lp:~vanvugt/compiz-core/fix-alt-bugs-2
Merge into: lp:compiz-core
Diff against target: 68 lines (+16/-18)
2 files modified
src/event.cpp (+11/-17)
src/screen.cpp (+5/-1)
To merge this branch: bzr merge lp:~vanvugt/compiz-core/fix-alt-bugs-2
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+96521@code.launchpad.net

Description of the change

Improved the fix for LP: #943194 so that it now works with GTK-2 menus too.
The first attempt only worked with GTK-3 it seems.

This also required that the fix for LP: #806255 be redesigned to avoid
XGrabKeyboard completely. Because that was part of what broke GTK-2 menus.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Daniel, thanks for working on that! Are you sure that the fix for LP: #806255 was what made gtk2 menus regressed? (we don't have this commit in the proposed snapshot and it was broken beforehand).

Anyway, I'm trying backporting both commits then :)

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

Yes, I definitely had to remove the XGrabKeyboard (fix for LP: #806255). I also had to change the XGrabKey mode to GrabModeSync to ensure the Alt keypress event was replayed correctly to the underlying app by XAllowEvents in alwaysHandleEvent.

I hope ubuntu downstream gets a new snapshot when 0.9.7.2 is done. Or even before then...

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

We are almost shipping trunk right now (rev 3039 minus rev 3036)
There is the lim merge we need to discuss as it will require a FFe that we denied (or reverted, or maybe conditionnally built, or having garantees the code isn't executed if the unity side isn't there), but that's a side talk. We tried to qualified rev 3035 at some point (and it's already frozen for 2 weeks) but we saw this alt regression which didn't let us ship it…

Revision history for this message
Alan Griffiths (alan-griffiths) :
review: Approve
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Tested and everything works fine (xul/qt apps)! Really nice work Daniel :)

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-07 09:31:30 +0000
3+++ src/event.cpp 2012-03-08 08:17:17 +0000
4@@ -143,30 +143,24 @@
5
6 if (state == CompAction::StateInitKey && grabs.empty ())
7 {
8- int pressTime = arguments[7].value ().i ();
9- int err = XGrabKeyboard (dpy, grabWindow, True,
10- GrabModeAsync, GrabModeAsync, pressTime);
11- /*
12- * We don't actually need this active grab for anything other than
13- * to test if it fails (AlreadyGrabbed). So we know if some other
14- * app has an active grab like a virtual machine or lock screen.
15- * (LP: #806255)
16- */
17- if (err == GrabSuccess)
18+ if (grabbed)
19 {
20- XUngrabKeyboard (dpy, pressTime);
21 possibleTap = action;
22- tapStart = pressTime;
23+ tapStart = arguments[7].value ().i ();
24 }
25 else
26 {
27- possibleTap = NULL;
28 /*
29- * Don't trigger any compiz actions if some other app has the
30- * keyboard grabbed (like a VM or locked screensaver). LP: #806255
31+ * If we received this keypress event and weren't grabbed then
32+ * the event doesn't belong to us. More likely belongs to
33+ * a different client's grab so ignore it. (LP: #806255)
34+ * The reason why we might receive such keypress events while
35+ * other clients have grabs is because of the XKB extension that
36+ * we're using. It sends you events even if they're not yours...
37+ * http://www.x.org/releases/current/doc/libX11/specs/XKB/xkblib.html
38 */
39- if (err == AlreadyGrabbed)
40- return false;
41+ possibleTap = NULL;
42+ return false;
43 }
44 }
45
46
47=== modified file 'src/screen.cpp'
48--- src/screen.cpp 2012-03-07 09:31:30 +0000
49+++ src/screen.cpp 2012-03-08 08:17:17 +0000
50@@ -3073,13 +3073,17 @@
51 {
52 if (grab)
53 {
54+ /*
55+ * Always grab the keyboard Sync-ronously. This is so that we can
56+ * choose to ReplayKeyboard in alwaysHandleEvent if need be.
57+ */
58 XGrabKey (dpy,
59 keycode,
60 modifiers,
61 root,
62 true,
63 GrabModeAsync,
64- GrabModeAsync);
65+ GrabModeSync);
66 }
67 else
68 {

Subscribers

People subscribed via source and target branches