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]

Re: asynchronous popups hide key release




Without knowing really what I was doing, I made a change that I thought might
work, but it didn't.  I'm open to suggestions.

Here is my change:

--- xc/programs/Xserver/hw/xwin/winkeybd.c    Fri Jun 15 04:09:20 2001
+++ build/std/programs/Xserver/hw/xwin/winkeybd.c  Tue Sep 25 10:41:15 2001
@@ -554,14 +554,17 @@
 }

 /*
- * Lift any modifier keys that are pressed
+ * Lift any keys that are pressed
+ * FIXME: should rename it "winKeybdReleaseKeys"
  */
 void
 winKeybdReleaseModifierKeys ()
 {
   xEvent           xCurrentEvent;
   BYTE                  bKeys[256];
-
+  int                   i;
+  int                   iScanCode;
+
   /*
    * FIXME: This isn't 100% correct, but it gets the job done
    * for now.  Might be a better idea to add some sort of flag...
@@ -585,10 +588,23 @@
       return;
     }

+  for (i = 1; i < 256; i++)
+    {
+      if (!(bKeys[i] & 128))
+    continue;
+
+      winTranslateKey ((WPARAM) i, (LPARAM) (i << 16), &iScanCode);
+      xCurrentEvent.u.u.detail = iScanCode;
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing i %d, iScanCode %d\n",
+          i, iScanCode);
+      mieqEnqueue (&xCurrentEvent);
+    }
+
   /* Pop VK_LMENU */
   if (bKeys[VK_LMENU] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LMENU\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LMENU == %d, KEY_Alt
+ MIN_KEYCODE == %d\n",
+          (int)VK_LMENU, (int)(KEY_Alt + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_Alt + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }
@@ -596,7 +612,8 @@
   /* Pop VK_RMENU */
   if (bKeys[VK_RMENU] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RMENU\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RMENU == %d,
KEY_AltLang + MIN_KEYCODE == %d\n",
+          (int)VK_RMENU, (int)(KEY_AltLang + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_AltLang + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }
@@ -604,7 +621,8 @@
   /* Pop VK_LCONTROL */
   if (bKeys[VK_LCONTROL] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LCONTROL\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LCONTROL == %d,
KEY_LCtrl + MIN_KEYCODE == %d\n",
+          (int)VK_LCONTROL, (int)(KEY_LCtrl + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_LCtrl + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }
@@ -612,7 +630,8 @@
   /* Pop VK_RCONTROL */
   if (bKeys[VK_RCONTROL] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RCONTROL\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RCONTROL == %d,
KEY_RCtrl + MIN_KEYCODE == %d\n",
+          (int)VK_RCONTROL, (int)(KEY_RCtrl + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_RCtrl + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }
@@ -620,7 +639,8 @@
   /* Pop VK_LSHIFT */
   if (bKeys[VK_LSHIFT] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LSHIFT\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_LSHIFT == %d,
KEY_ShiftL + MIN_KEYCODE == %d\n",
+          (int)VK_LSHIFT, (int)(KEY_ShiftL + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_ShiftL + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }
@@ -628,7 +648,8 @@
   /* Pop VK_RSHIFT */
   if (bKeys[VK_RSHIFT] & 128)
     {
-      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RSHIFT\n");
+      ErrorF ("winKeybdReleaseModifierKeys - Releasing VK_RSHIFT == %d,
KEY_ShiftR + MIN_KEYCODE == %d\n",
+          (int)VK_RSHIFT, (int)(KEY_ShiftR + MIN_KEYCODE));
       xCurrentEvent.u.u.detail = KEY_ShiftR + MIN_KEYCODE;
       mieqEnqueue (&xCurrentEvent);
     }


Thanks
-John





Alexander Gottwald <alexander.gottwald@informatik.tu-chemnitz.de> on 19-09-2001
01:31:13 PM

To:
cc:   cygwin-xfree@sourceware.cygnus.com (bcc: John Tobey/Intdata)

Subject:  Re: asynchronous popups hide key release




On Wed, 19 Sep 2001 John_Tobey@notes.intdata.com wrote:

>
> One annoyance comes from the interaction with X and native Windows apps that
run
> in the background and occasionally pop up a window to notify me of e.g. new
> mail.  If I happen to be typing and have a key down when the popup appears, X
> does not notice that I release the key, and it goes into auto repeat, sending
> dozens of keystroke messages to apps until I press another key with X in
focus.

I hear rumors that some versions of tweakui have an option which prevents
other windows applications from "stealing" the focus, but I could not
verify this.

> IMHO, the X server should handle de-focus events (if there are such things?)
by
> considering any keys are currently down to be released.  At the very least, it
> should disable autorepeat when it doesn't have focus.

You are welcome to code it. You can reuse parts of the code where we
release the control and alt keys on losing focus.

bye
     ago
--
 Alexander.Gottwald@informatik.tu-chemnitz.de
 http://www.gotti.org           ICQ: 126018723
 phone: +49 3725 349 80 80    mobile: +49 172 7854017






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