Is behavior of GrabKey correct in the X server?

Lasse Collin lasse.collin at tukaani.org
Wed May 30 12:38:22 PDT 2007


I'm wondering if the behavior of the X server matches the X11 protocol 
specification with regard to GrabKey and related requests.

From the X11 protocol specification about GrabKey:

    This request establishes a passive grab on the keyboard.
    [...]
    This request overrides all previous passive grabs by the
    same client on the same key combinations on the same window.

What does "overrides all previous passive grabs" mean?
(a) Forget the old grab forever and replace it with the new grab.
(b) Keep the old grab in memory and use it again when the new grab
    has been ungrabbed.

In other words: if a client requests a grab for the same key combination 
ten times, does it need to ungrab it ten times or only once?

From the X11 protocol specification about UngrabKey:

    This request releases the key combination on the specified
    window if it was grabbed by this client.

Man pages of libX11 (XGrabKey) don't clear this up either.

Currently the X server does (b). As a result, if a client requests a 
grab for the same key combination very many times, the X server slows 
down badly. When such client gets killed, X server may hang for several 
*minutes* to release all the grabs.

I'm hoping that (a) would be the correct behavior. It would resolve 
<https://bugs.freedesktop.org/show_bug.cgi?id=2738>.

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode



More information about the xorg mailing list