XGrabKey questions
Peter Hutterer
mailinglists at who-t.net
Thu Feb 28 01:00:56 PST 2008
Wang Baisheng wrote:
> I am using the XGrabKey, but I am confused...
this is a mandatory requirement for grabs. if you wouldn't be, the MiB
would be after you.
> First, for params keyboard_mode, the man page says "If the keyboard_mode
> argument is GrabModeAsync, keyboard event processing continues as usual", but
> when I write some code like, " XGrabKey(display, XKeysymToKeycode(display,
> XK_d), 0, rootWindow, True, GrabModeAsync, GrabModeAsync);", the focus
> application can not receive any key d press event.
this is correct. you told the x server to deliver any d press that
happens on the root window (== every press) to you. No matter who has
the focus.
grabs work top down (checking the root window first for grabs). event
delivery works bottom up (checking focus window first for delivery).
This is an important distinction.
> And the man page says "Actual keyboard changes are not lost while the
> keyboard is frozen; they are simply queued in the server for later
> processing", but after I receive the key press event, I call XAllowEvents,
> but I can not receive any KeyRelease event, why ?
you can't XAllowEvents if you don't freeze the device. so it's either
GrabModeAsync or XAllowEvents.
Cheers,
Peter
More information about the xorg
mailing list