Author: jimtabor Date: Sun Aug 19 23:16:39 2012 New Revision: 57110
URL: http://svn.reactos.org/svn/reactos?rev=57110&view=rev Log: [NtUser] - Fix last Win test_keyboard_input. No Focus use Active! Read MSDN WM_SYSKEYDOWN/UP.
Modified: trunk/reactos/win32ss/user/ntuser/keyboard.c
Modified: trunk/reactos/win32ss/user/ntuser/keyboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/keyboar... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] Sun Aug 19 23:16:39 2012 @@ -803,11 +803,20 @@ if (wSimpleVk == VK_SHIFT) /* shift can't be extended */ bExt = FALSE;
+ /* If we have a focus queue, post a keyboard message */ + pFocusQueue = IntGetFocusMessageQueue(); + TRACE("ProcessKeyEvent Q 0x%p Active pWnd 0x%p Focus pWnd 0x%p\n", + pFocusQueue, + (pFocusQueue ? pFocusQueue->spwndActive : 0), + (pFocusQueue ? pFocusQueue->spwndFocus : 0)); + /* If it is F10 or ALT is down and CTRL is up, it's a system key */ - if (wVk == VK_F10 || + if ( wVk == VK_F10 || (wSimpleVk == VK_MENU && bMenuDownRecently) || (IS_KEY_DOWN(gafAsyncKeyState, VK_MENU) && - !IS_KEY_DOWN(gafAsyncKeyState, VK_CONTROL))) + !IS_KEY_DOWN(gafAsyncKeyState, VK_CONTROL)) || + // See MSDN WM_SYSKEYDOWN/UP fixes last wine Win test_keyboard_input. + (pFocusQueue && !pFocusQueue->spwndFocus) ) { bMenuDownRecently = FALSE; // reset if (bIsDown) @@ -843,24 +852,29 @@ TRACE("Alt-Tab/Esc Pressed wParam %x\n",wVk); }
- /* If we have a focus queue, post a keyboard message */ - pFocusQueue = IntGetFocusMessageQueue(); - TRACE("ProcessKeyEvent Q 0x%p Focus pWnd 0x%p\n",pFocusQueue, pFocusQueue ? pFocusQueue->spwndFocus : 0); if (bIsDown && wVk == VK_SNAPSHOT) { if (pFocusQueue && IS_KEY_DOWN(gafAsyncKeyState, VK_MENU) && !IS_KEY_DOWN(gafAsyncKeyState, VK_CONTROL)) { - SnapWindow(pFocusQueue->spwndFocus ? UserHMGetHandle(pFocusQueue->spwndFocus) : 0); + // Snap from Active Window, Focus can be null. + SnapWindow(pFocusQueue->spwndActive ? UserHMGetHandle(pFocusQueue->spwndActive) : 0); } else - SnapWindow(NULL); + SnapWindow(NULL); // Snap Desktop. } else if (pFocusQueue && bPostMsg) { + PWND Wnd = pFocusQueue->spwndFocus; + if (!Wnd) + { + // Focus can be null so going with Active. WM_SYSKEYXXX last wine Win test_keyboard_input. + Wnd = pFocusQueue->spwndActive; + } + /* Init message */ - Msg.hwnd = pFocusQueue->spwndFocus ? UserHMGetHandle(pFocusQueue->spwndFocus) : 0; + Msg.hwnd = UserHMGetHandle(Wnd); Msg.wParam = wFixedVk & 0xFF; /* Note: It's simplified by msg queue */ Msg.lParam = MAKELPARAM(1, wScanCode); Msg.time = dwTime;