Index: win32ss/user/ntuser/hotkey.c =================================================================== --- win32ss/user/ntuser/hotkey.c (revision 67979) +++ win32ss/user/ntuser/hotkey.c (working copy) @@ -36,7 +36,7 @@ // HOT_KEY hkWinKey = {NULL, 1, MOD_WIN, 0, IDHK_WINKEY, &hkShiftF12}; PHOT_KEY gphkFirst = NULL; -BOOL bWinHotkeyActive = FALSE; +BOOL bIgnoreNextWinKeyUp = FALSE; /* FUNCTIONS *****************************************************************/ @@ -208,31 +208,42 @@ return DoNotPostMsg; } + if (pHotKey->id == IDHK_WINKEY && bIsDown) + { + //pure Winkey DOWN is never a hotkey + return FALSE; + } + /* Process hotkey if it is key up event */ if (!bIsDown) { /* WIN and F12 keys are not hardcoded here. See comments on top of this file. */ - if (pHotKey->id == IDHK_WINKEY && bWinHotkeyActive) + if (fModifiers & VK_LWIN) { - pWnd = ValidateHwndNoErr(InputWindowStation->ShellWindow); - if (pWnd) + //we found left windows key up + if (!bIgnoreNextWinKeyUp) { - TRACE("System Hot key Id %d Key %u\n", pHotKey->id, wVk ); - UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); - co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); - bWinHotkeyActive = FALSE; - return FALSE; + pWnd = ValidateHwndNoErr(InputWindowStation->ShellWindow); + if (pWnd) + { + TRACE("System Hot key Id %d Key %u\n", pHotKey->id, wVk ); + UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); + co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); + return FALSE; + } } + else + { + if (wVk == 0) + { + //the user released the pure! win key after previous hotkey action + //this is the last time we have to ignore it + bIgnoreNextWinKeyUp = FALSE; + } + return FALSE; + } } } - else - { /* The user pressed the win key */ - if (pHotKey->id == IDHK_WINKEY) - { - bWinHotkeyActive = TRUE; - return FALSE; - } - } if (bIsDown) { @@ -269,6 +280,8 @@ { TRACE("UPM Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); + // we ignore the next win-key-up to not open the start menu accidently + bIgnoreNextWinKeyUp = TRUE; } //ptiLastInput = pWnd->head.pti; return TRUE; /* Don't send any message */