This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: New devel to-do item (release all pressed keyboard keys on focus loss)




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?

-John

==========BEGIN xterm OUTPUT==============
[jtobey@BED-JTOBEY-W] (0) ~/x-devel/build/hacked/programs/Xserver
$
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfass890-qwertyuiop[]
~\\bash:
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfass890-qwertyuiop[]:
 command not found
[jtobey@BED-JTOBEY-W] (127) ~/x-devel/build/hacked/programs/Xserver
$ adfghjkl;'`\zxcvbnm,./* ~~~~0~1~~~~<3~4~~~
> /9
==========END xterm OUTPUT==============

==========BEGIN PATCH==============
--- ../../../../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)
     return;

+#if 1
+  ErrorF("Nuking 'modifier' keys!\n");
+  {
+    int i;
+    for (i = 1; i < 128; i++)
+      switch (i)
+    {
+    default:
+      winSendKeyEvent (i, FALSE);
+      break;
+    case KEY_CapsLock:
+    case KEY_ScrollLock:
+    case KEY_NumLock:
+      break;
+    }
+ }
+#else
   winSendKeyEvent (KEY_Alt, FALSE);
   winSendKeyEvent (KEY_AltLang, FALSE);
   winSendKeyEvent (KEY_LCtrl, FALSE);
   winSendKeyEvent (KEY_RCtrl, FALSE);
   winSendKeyEvent (KEY_ShiftL, FALSE);
   winSendKeyEvent (KEY_ShiftR, FALSE);
+#endif
 }
 ==========END PATCH==============







"Harold Hunt" <huntharo@msu.edu> on 03-12-2001 12:50:08 PM

To:   John Tobey/Intdata@INTDATA
cc:   "cygx" <cygwin-xfree@cygwin.com>

Subject:  RE: New devel to-do item (release all pressed keyboard keys on focus
      loss)




John,

> 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?

Harold






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]