Duplicate Keystrokes - Again, Again!

Harold L Hunt II huntharo@msu.edu
Mon Apr 7 14:42:00 GMT 2003


Jean-Claude,

Jean-Claude Gervais wrote:
> Harold, guys,
> 
> 	I'm just about certain that the repeated keys are caused by latency, not by
> load:
> 
> 	When I use Netmeeting to control a machine running Cygwin-XFree and I see
> the duplicated-keystroke problem often.
> 

Yeah, that is what I meant by high-load causing the problem.  Basically, 
anything that causes a delay between keystrokes is causing the problem.

> When this happens, almost without exception, it is NOT the machine running
> Cygwin-XFree nor the machine running Linux who are under high load. Even the
> machine I am using to remote control is not under heavy load.
> 
>  It is rather, without fail, when the telecommunications link the Netmeeting
> session is routed over is running at capacity.
> 
> Is it a workable hypothesis to suggest that what might be happening is this:
> 
> A keydown message is arriving at Cygwin-XFree, and it takes too long for a
> key-up message to arrive, so Windows generates another key event?
> 

No, that most certainly is not it.  I have said, many many times, that I 
followed a single key press message (WM_KEYDOWN) all the way down as far 
as I could with gdb.  When I hit 'continue', BAM! I get two key strokes 
in the X Client.  gdb then looped around to the breakpoint set in the 
WM_KEYDOWN message processing.  So, there is no way that a WM_KEYDOWN 
could have snuck by me.  I can say for certain that this was one 
WM_KEYDOWN causing two keystrokes to appear.

> I seem to remember that Windows works like this -
> 
> WM_KEYDOWN
> 
> WM_CHAR
> 
> if a pause of X milliseconds occurs here, Windows does this -
> 
> WM_KEYDOWN
> WM_CHAR
> 
> WM_KEYDOWN
> WM_CHAR
> ...	More WM_KEYDOWNs and WM_CHARs until a WM_KEYUP arrives.
> WM_KEYUP
> 
> The interesting part is that both the WM_KEYDOWN and WM_CHAR messages have a
> flag in them called 'fRepeat' that will be set to 1 (true) if this is the
> case.
> 
> Anyhow, I downloaded the code for Cygwin's X server and I will spelunk it
> soon.
> 
> I'd appreciate any ideas in the meantime.
> 

Let us know what you can figure out.

Harold

> 
> -----Original Message-----
> From: cygwin-xfree-owner@cygwin.com [mailto:cygwin-xfree-owner@cygwin.com]On
> Behalf Of Harold L Hunt II
> 
> It could be the delay between the
> down message and the up message that is causing this.  But, like I said,
> I looked through almost all of the code and nowhere could I find a part
> that looped and created extra keypresses in the X Client.
> 



More information about the Cygwin-xfree mailing list