On Mon, Apr 05, 2004 at 02:32:30PM +0300, Tuomo Valkonen wrote: > On Mon, Apr 05, 2004 at 09:59:33AM +0100, Tom Payne wrote: > > Per Olofsson writes: > > >Anybody else who has experienced this problem? > > Yes, I see it occasionally. > > Yes, there does seem to be such a bug.. but I'm not sure if it is in Ion, > or if there's any way around it at this point. Ion simply never seems to > receive or get to handle the key release events that it waits for to > release the grab. Sometimes they seem to be in the client-side buffers > already when we make the grab, but then disappear.
Alright, I think I have discovered the cause of the problem. First of all, on the system I'm on now, the problem only seems to occur with bloated and slow programs such as Mozilla (Firefox). I can't get it to happen with XTerm and Xev, no matter how much I try. Now, if you quickly switch to full screen mode and back, the system is still busy with Mozilla (or other slow&bloated program) arranging itself to full screen state, and when Ion finally gets its turn to run, the keys have already been released and the release of _Enter_ key reported to us. However, we only release waitrelease grabs when all modifiers have been released, as X in its great wisdom generates artificial key release (in addition to press) events when repeating keys. Modifiers, on the other hand, usually do not repeat. However, the modifier has already been release when we get to make the grab, and thus we never get to know of the release. The solution is to query X for keyboard state before making the grab, and check if any "friendly" (non-lock) modifiers are set. If not, don't make the grab. The fix can be found in the Subversion repository for both Ion2 and Ion3. -- Tuomo
