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;