Hi,

On 8/16/2011 5:31 PM, Oliver Schmidt wrote:
> I had the problem, that the state of the modifier keys was lost when a
> window is created (or raised).
> I send a patch to fix this problem with this email: I just extended the

I just merged the current official source from xorg-server-1.11.3-1 into
my local development source and discovered, that my patch for the
problem "lost modifier key after a new window is created" has not been
applied.

Is there a chance, that this patch could be applied to a future version
or that another solution could be provided to fix this problem? I'm also
attaching a newer version of the patch with this email.

Best regards,
Oliver

diff --git a/cygwin/hw/xwin/winkeybd.c b/cygwin/hw/xwin/winkeybd.c
index 278342f..a2ac4d0 100644
--- a/cygwin/hw/xwin/winkeybd.c
+++ b/cygwin/hw/xwin/winkeybd.c
@@ -283,6 +283,29 @@ winRestoreModeKeyStates (void)
    * have a logical XOR operator, so we use a macro instead.
    */
 
+  {
+    /* consider modifer keys */
+    
+    BOOL ctrl   = (GetAsyncKeyState (VK_CONTROL) < 0);
+    BOOL shift  = (GetAsyncKeyState (VK_SHIFT)   < 0);
+    BOOL alt    = (GetAsyncKeyState (VK_LMENU)   < 0);
+    BOOL altgr  = (GetAsyncKeyState (VK_RMENU)   < 0);
+
+    if (ctrl && altgr) ctrl = FALSE;
+    
+    if (WIN_XOR (internalKeyStates & ControlMask, ctrl))
+      winSendKeyEvent (KEY_LCtrl, ctrl);
+  
+    if (WIN_XOR (internalKeyStates & ShiftMask, shift))
+      winSendKeyEvent (KEY_ShiftL, shift);
+  
+    if (WIN_XOR (internalKeyStates & Mod1Mask, alt))
+      winSendKeyEvent (KEY_Alt, alt);
+  
+    if (WIN_XOR (internalKeyStates & Mod5Mask, altgr))
+      winSendKeyEvent (KEY_AltLang, altgr);
+  }
+
   /* Has the key state changed? */
   dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
   if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
@@ -328,7 +351,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
   MSG          msgNext;
   LONG         lTime;
   Bool         fReturn;
-
+  
   static Bool   lastWasControlL = FALSE;
   static UINT   lastMessage;
   static LONG   lastTime;

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

Reply via email to