This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
RE: New devel to-do item (release all pressed keyboard keys on focus loss)
- From: "Harold Hunt" <huntharo at msu dot edu>
- To: <John_Tobey at notes dot intdata dot com>
- Cc: "cygx" <cygwin-xfree at cygwin dot com>
- Date: Thu, 13 Dec 2001 21:47:12 -0500
- Subject: RE: New devel to-do item (release all pressed keyboard keys on focus loss)
John,
Have you finished up your patches for key releasing on loss of keyboard
focus?
If so, please submit a patch by doing the following:
cd xc/programs/Xserver/hw
cvs diff -U3 xwin > xwin.diff
If not, good luck figuring out those last little details,
Harold
> -----Original Message-----
> From: John_Tobey@notes.intdata.com [mailto:John_Tobey@notes.intdata.com]
> Sent: Wednesday, December 05, 2001 5:09 PM
> To: Harold Hunt
> Cc: cygx
> Subject: RE: New devel to-do item (release all pressed keyboard keys on
> focus loss)
>
>
>
>
> > > I suppose for this the solution would be to make winSendKeyEvent
> > > do nothing if
> > > its fDown already matches the array element
>
> > Nah, you can't do that because we sometimes call
> winSendKeyEvent multiple
> > times from winwndproc/winWindowProc()/WM_KEYDOWN if the key has a repeat
> > count.
>
> But I can do it when both are *false*. This goes over my earlier patch:
>
> --- winkeybd.c~ Tue Dec 4 16:42:28 2001
> +++ winkeybd.c Wed Dec 5 16:39:49 2001
> @@ -439,7 +439,12 @@
> winSendKeyEvent (DWORD dwKey, Bool fDown)
> {
> xEvent xCurrentEvent;
> -
> +
> + /* Ignore ups without a preceding down. This happens when a keystroke
> + causes X to gain focus. */
> + if (!fDown && !g_fKeyStates[dwKey])
> + return;
> +
> ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent));
>
> xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease;
>
> > I'm kinda confused here. You need to add an ErrorF () to WM_KEYDOWN and
> > WM_KEYUP to see if the doubled key message is being sent again
> immediately
> > after we regain focus.
>
> Here is my XWin.log:
>
> keydown #16 at 22939
> keyup #16 at 23250
> keydown #17 at 23320
> keyup #17 at 23570
> keydown #18 at 23680
> keyup #18 at 23981
> keydown #19 at 24091
> keyup #19 at 24412
> keydown #16 at 24452
> keyup #16 at 24752
> keydown #17 at 24792
> Simulating release of key #17!
> killfocus at 24862
> setfocus at 32363
> keyup #45 at 32483
> killfocus at 42017
>
> And here is my xterm after the setfocus at 32363 ms:
>
> $ qwerqww
>
> 'w' is key #17. The only thing that could be happening is that xterm is
> outsmarting itself by doing something with its own killfocus. My
> preference is
> to let xterm users deal. We're used to it. :-)
>
> > > I doubt
> > > whether I can figure it out completely without a major time
> investment.
>
> > This is your baby now, and you're making good progress. Don't be
> > discouraged. These things take time to work out correctly.
>
> Without your help, I would probably lose patience.
>
> -John
>
>