Patch for keyboard handling

Harold L Hunt II huntharo@msu.edu
Wed Nov 5 21:22:00 GMT 2003


Takuma,

Takuma Murakami wrote:

> I agree with you.  If the mi event queue has pending
> events when winRestoreModeKeyStates is called, it may
> fail to synchronize mode key states between XWin and
> Windows.  However, the new code can re-sync them at
> the next time winRestoreModeKeyStates is called while
> it is hard to do for the old code.

Okay.

> Thank you for your suggestion.  mieqProcessInputEvents
> seems to do the work.  I inserted a code to call it
> and it looks working well for now, though I don't sure
> if it is legal to call it from the place other than
> ProcessInputEvents.
> 
> The attached is a revised patch to call the function.
> I deeply appreciate your feedback.

Looks good, but I think you are right about some danger in calling 
mieqProcessInputEvents.

Hmm... the problem with calling ProcessInputEvents or 
mieqProcessInputEvents from our keyboard processing is that it causes 
input events to be processed one at a time, instead of in a queue.  It 
completely negates the purpose of having an input queue in the X layer.


I think I understand your original patch better now and I think that you 
were probably doing it correctly, but I can't verify that right now.  If 
this is what you were trying to do, then it probably is correct:

1) Assume that no keyboard input is in the mi queue when winWindowProc 
is called.

2) If we are getting the keyboard focus, grab the Windows mode key state 
and X mode key state, compare them, and send fake key presses to X to 
get the two states in synch.

3) Do not synch the key states anywhere else.

That would probably work because it would enqueue key messages that will 
synch the mode key states before placing normal key messages in the 
queue.  Thus, when we ask X for the mode key states we should get a 
consistent result since the input queue in X is empty.

Does that sound like what you were trying to do initially?  I got 
confused because I couldn't keep track of where all the calls to 
winRestoreModeKeyStates would up.

Let me know,

Harold



More information about the Cygwin-xfree mailing list