A thought about stuck keys

Harold L Hunt II huntharo@msu.edu
Tue Mar 4 21:02:00 GMT 2003


Jean-Claude,

Unfortunately, it is nowhere near that simple.  Search the message 
archives for my notes on this.  I sent at least one rather long and 
detailed message about this.

In brief, I ran XWin.exe in a debugger and watched the keypresses being 
handled.  The problem with your theory is that a single keypress message 
results in a several function calls that drill deeper and deeper into 
the generic X code...  I drilled all the way down as far as I could 
(following a single keypress message, mind you) and BAM! two key presses 
show up in xterm from the processing of a single keypress message.

So, we definitely don't need any kind of debouncing algorithm at the 
Cygwin/XFree86 level.  This problem is either deep inside the generic X 
code (I couldn't find anywhere where the keypress was being duplicated) 
or it was happening in some Cygwin code.

I would not doubt it if this was due to something in Cygwin... since the 
problem only comes out when the machine is under very heavy load (such 
as running the Native GDI engine for XWin.exe) or perhaps when working 
remotely.  This indicates to me that the bug is either due to a race or 
some sort of key repeat feature in Cygwin that is looking at the time 
difference between the key press message (is it peeking at that or does 
it have it cached somewhere?) and the time that the Cygwin keyboard 
handler gets called.  I could be talking total nonsense here, but this 
seems plausible to me.

Here is a question: have you ever seen this happen in a program other 
than xterm or a program that is running inside an xterm?  If not, then 
this may be a problem in xterm, not in Cygwin.  I would really like to 
know the answer to this one.

Harold

Jean-Claude Gervais wrote:
> Hi,
> 
> 	I am using Microsoft Netmeeting to control a box running Cygwin XFree, and
> like some of you have already noted, occasionally whatever is typed on the
> keyboard gets echoed several times, acting almost like a stuck key. This
> seems to happen to me MUCH, MUCH more when I am working remotely as I am
> than when I am logged in locally or have a one-hop connection.
> 
> 	I don't know XWindows very well, but it almost looks like the X keyboard
> event-handler is getting fooled because of the extra latency the
> communications channel is adding to the event times.
> 
> 	For example, it seems like X sees a keydown message and responds to it,
> sees another (duplicate) keydown message (for the same key) and doesn't make
> sure there has been an intervening keyup message between the two. A
> de-bouncing algorithm could do the job here.
> 
> 	Maybe this is normal; that multiple keydown messages will get sent if you
> hold down a key, but I am curious to know if this is something that can be
> configured away.
> 
> 	So, in summary, I'd like to know if it is possible to configure XFree to
> NOT generate multiple keydown messages for ONE keypress.
> 
> Thanks.
> 
> 



More information about the Cygwin-xfree mailing list