New devel to-do item (release all pressed keyboard keys on focus loss)
Tue Dec 4 11:28:00 GMT 2001
There's nothing too hard about it, but it doesn't work. The winSendKeyEvent()
calls seem to result in keydown events, judging by this output from my test.
Here I sent myself an email, started slowly typing 'asdf' into an xterm, and
waited until the email notification popped up. The text from 890-qwerty... on
seems to have come from my patch, included below.
(Apologies if the lines wrap.)
I suppose the next step will be to keep an array of flags indicating what keys
are down. When should one set/clear the flags?
==========BEGIN xterm OUTPUT==============
[jtobey@BED-JTOBEY-W] (0) ~/x-devel/build/hacked/programs/Xserver
command not found
[jtobey@BED-JTOBEY-W] (127) ~/x-devel/build/hacked/programs/Xserver
$ adfghjkl;'`\zxcvbnm,./* ~~~~0~1~~~~<3~4~~~
==========END xterm OUTPUT==============
--- ../../../../xc/programs/Xserver/hw/xwin/winkeybd.c Mon Dec 3 16:38:20 2001
+++ hw/xwin/winkeybd.c Tue Dec 4 10:45:00 2001
@@ -403,12 +403,30 @@
if (g_fdMessageQueue == WIN_FD_INVALID)
+ ErrorF("Nuking 'modifier' keys!\n");
+ int i;
+ for (i = 1; i < 128; i++)
+ switch (i)
+ winSendKeyEvent (i, FALSE);
+ case KEY_CapsLock:
+ case KEY_ScrollLock:
+ case KEY_NumLock:
winSendKeyEvent (KEY_Alt, FALSE);
winSendKeyEvent (KEY_AltLang, FALSE);
winSendKeyEvent (KEY_LCtrl, FALSE);
winSendKeyEvent (KEY_RCtrl, FALSE);
winSendKeyEvent (KEY_ShiftL, FALSE);
winSendKeyEvent (KEY_ShiftR, FALSE);
"Harold Hunt" <email@example.com> on 03-12-2001 12:50:08 PM
To: John Tobey/Intdata@INTDATA
cc: "cygx" <firstname.lastname@example.org>
Subject: RE: New devel to-do item (release all pressed keyboard keys on focus
> By "novice programmer" he means one intimately familiar with X
> server internals
> and the Win32 API.
Not at all. I mean look in winkeybd.c for the function that pops the mod
keys (Alt, Ctrl, Shift, etc.) and simply make it loop through all keys not
including the mode keys (Num Lock, Caps Lock, etc.), popping each key.
How hard is it to write a for loop based on example code?
More information about the Cygwin-xfree