silly keycode question

Peter Hutterer peter.hutterer at
Sun Jan 31 21:34:59 PST 2010

On Sun, Jan 24, 2010 at 01:49:36PM +0100, Tom Cowell wrote:
> In my experiments, I didn't want to do what Glynn suggested because I
> will be repeatedly changing the grabbed keys during the lifetime of
> the program. All the calls to XGrabKey seemed like a lot of overhead
> to me.
> So I did something different: my program is, for other reasons, using
> the Xkb extension, and processing XkbStateNotifyEvent to track the
> state of modifier keys. When Ctrl is pressed I grab the keys I want
> with AnyModifier, and when it is released I release them.
> This works for me, but I don't like it, so I think I will probably try
> what Glynn has suggested.

it has an inherent race condition in that the key is not grabbed in between
delivering the event and your client re-grabbing the key. Plus, there's the
issue that if another client has a grab on the same key you'll run into
issues with AnyModifier.


More information about the xorg mailing list