Merge lp:~unity-team/compiz/trunk.grabs into lp:~unity-team/compiz/trunk

Proposed by Sam Spilsbury
Status: Merged
Approved by: David Barth
Approved revision: 2725
Merged at revision: 2727
Proposed branch: lp:~unity-team/compiz/trunk.grabs
Merge into: lp:~unity-team/compiz/trunk
Diff against target: 36 lines (+17/-1)
1 file modified
src/event.cpp (+17/-1)
To merge this branch: bzr merge lp:~unity-team/compiz/trunk.grabs
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Chase Douglas (community) Approve
Review via email: mp+55800@code.launchpad.net

Description of the change

Ungrab the keyboard as soon as key is handled, not after key released (implicitly)

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

Seems reasonable to me.

review: Approve
Revision history for this message
David Barth (dbarth) wrote :

What's the related bug report, and how can one test that the change does
a/ fix the problem
b/ does not create a regression

Can you provide 2 simple test procedures (manual test cases) to verify that?

review: Needs Information
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Added a test case

lp:~smspillaz/+junk/grabtests

HOW TO TEST:

1) Unload the unity plugin (seems to be a bug in cairo that causes a crash with no backtrace here, not sure what's up with that). Unloading the unity plugin DOES NOT affect the results of this test, since it is a test of compiz core NOT unity.
2) Load the "Test Grabs" plugin
3) Launch compiz in a terminal (eg compiz --replace ccp &)
4) Press Control-Alt-t, which should display a message
5) Press Control-Alt-y, which should display a message, releasing Control or Alt will display another, releasing y will NOT
6) Press Control-Alt-i, which should display a message, pressing any other key should also display a message, until Control-Alt-i pressed again
7) Press Control-Alt-o, which should display a message, pressing keys Q W E R T Y should also display a message, any other key should "pass through" to applications, until Control-Alt-o pressed again
8) Launch app/testgrabs, enter "1" if the window displayed, press a, press control-a and it will exit. A message will be displayed in testgrabs and in compiz, saying that you pressed Control, but the app will still get Control-a this time around.

Revision history for this message
David Barth (dbarth) :
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 2011-03-27 04:14:46 +0000
3+++ src/event.cpp 2011-03-31 17:49:30 +0000
4@@ -987,6 +987,7 @@
5
6 CompWindow *w = NULL;
7 XWindowAttributes wa;
8+ bool actionEventHandled = false;
9
10 switch (event->type) {
11 case ButtonPress:
12@@ -1015,8 +1016,23 @@
13 if (priv->grabs.empty ())
14 XAllowEvents (priv->dpy, AsyncPointer, event->xbutton.time);
15
16+ actionEventHandled = true;
17+ }
18+
19+ if (priv->grabs.empty ())
20+ {
21+ switch (event->type)
22+ {
23+ case KeyPress:
24+ XUngrabKeyboard (priv->dpy, event->xkey.time);
25+ break;
26+ default:
27+ break;
28+ }
29+ }
30+
31+ if (actionEventHandled)
32 return;
33- }
34
35 switch (event->type) {
36 case SelectionRequest:

Subscribers

People subscribed via source and target branches

to all changes: