A thought about stuck keys
Harold L Hunt II
Wed Mar 5 01:41:00 GMT 2003
Heh... yes, I am sure that we will eventually understand this bug, but I
spent long enough in the debugger on this one that I don't ever want to
look at it again :)
Jean-Claude Gervais wrote:
> No problem Harold,
> Such a gallant answer to my query deserves every bit of assistance I can
> To answer your question; YES, this does happen outside of XTerm, to ME at
> least, when I am running Gaim.
> I am controlling/using the Redhat version of Gaim (native Linux, in other
> words) through Cygwin's XFree on my Windows XP box (over a 100MB network),
> which is in turn being controlled remotely by Netmeeting over a high-latency
> network (the Internet)
> OK, yes, I do seem to remember your original posts about this, which I
> don't yet have enough X-savvy to understand totally, but I was trying to
> maybe spark some idea by coming from a different direction.
> In any case, if we can rule out my hypothesis, then that is good too: It
> will be ONE down and X others to go, and eventually we WILL understand what
> is going on here and we'll be able to fix it, I am sure.
> -----Original Message-----
> From: email@example.com [mailto:firstname.lastname@example.org]On
> Behalf Of Harold L Hunt II
> Sent: Tuesday, March 04, 2003 2:46 PM
> To: email@example.com
> Subject: Re: A thought about stuck keys
> 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.
> Jean-Claude Gervais wrote:
>> 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
>>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
>>sees another (duplicate) keydown message (for the same key) and doesn't
>>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
>> So, in summary, I'd like to know if it is possible to configure
> XFree to
>>NOT generate multiple keydown messages for ONE keypress.
More information about the Cygwin-xfree