Bug 39545

Summary: XGrabKey may get overridden by another grab call after the combination is pressed
Product: xorg Reporter: ultr <ultr>
Component: Lib/XlibAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: daniel, peter.hutterer
Version: 7.6 (2010.12)   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 36141    
Description Flags
Test case for XGrabKey overriding. none

Description ultr 2011-07-26 03:21:09 UTC
Created attachment 49557 [details]
 Test case for XGrabKey overriding.

I don't know if I'm doing something wrong or is it a bug.
But it used to work until current version of xorg.

Steps to reproduce:

- XGrabKey(Alt+A) from client 1 - Success
- XGrabKey(Alt+A) from client 2 - BadAccess (OK)


- XGrabKey(Alt+A) from client 1 - Success
- User presses Alt+A combination
- XGrabKey(Alt+A) from client 2 - Success (!), while it should be BadAccess

Now the first grab is overriden by the second one.
When the second grab is released, first one starts receiving events again.

Test case code attached.
Comment 1 ultr 2011-07-26 06:49:07 UTC
Note: Make sure you have your Num- and CapsLock turned OFF when you run the attached program.
Comment 2 Peter Hutterer 2011-07-27 23:10:07 UTC
Comment 3 ultr 2011-08-28 08:07:02 UTC
Which version of Xorg can be expected to include this fix?
Comment 4 Daniel Stone 2011-08-28 08:11:39 UTC
Unfortunately this fix didn't make 1.11.0, but it will be in 1.12, and
likely in a later 1.11.x release.

On 28 August 2011 16:07,  <bugzilla-daemon@freedesktop.org> wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=39545
> --- Comment #3 from ultr <ultr@ultr.pl> 2011-08-28 08:07:02 PDT ---
> Which version of Xorg can be expected to include this fix?
> --
> Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
Comment 5 Jeremy Huddleston Sequoia 2011-10-03 17:27:57 UTC
I want this in 1.11.2, marking as blocker
Comment 6 Jeremy Huddleston Sequoia 2011-10-14 16:51:42 UTC
commit 843737b4f979fed3a6d74cdfc7047ce5ca886639
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Jul 28 15:56:08 2011 +1000

    dix: ignore devices when adding passive core grabs to list (#39545)
    Passive core grabs are mostly device-independent. In an MPX scenario, they
    may change to reflect whichever master pair activated the grab last. For
    adding new grabs to the list, ignore the device for core grabs to return
    failures when trying to set the same grab combo twice on a window.
    X.Org Bug 39545 <http://bugs.freedesktop.org/show_bug.cgi?id=39545>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Daniel Stone <daniel@fooishbar.org>
    (cherry picked from commit 09496996accfdaf7bc01097a25db400912004d97)

Please test 1.11.2 RC1

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.