From 8b395029eeb722cb16182b57fe6fb8ed16ad60b8 Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Sat, 8 Oct 2011 23:33:26 +0000 Subject: [PATCH] [WIN32K] - Rename gKeyStateTable to gafAsyncKeyState: it's a proper name - Fix accelerators regression svn path=/trunk/; revision=54058 --- .../subsystems/win32/win32k/include/input.h | 2 +- .../win32/win32k/ntuser/accelerator.c | 13 +++-- .../subsystems/win32/win32k/ntuser/input.c | 25 +++++----- .../subsystems/win32/win32k/ntuser/keyboard.c | 50 +++++++++---------- .../subsystems/win32/win32k/ntuser/msgqueue.c | 2 +- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/input.h b/reactos/subsystems/win32/win32k/include/input.h index 36d7f232639..9eac220ffb8 100644 --- a/reactos/subsystems/win32/win32k/include/input.h +++ b/reactos/subsystems/win32/win32k/include/input.h @@ -56,4 +56,4 @@ VOID FASTCALL DoTheScreenSaver(VOID); extern HANDLE ghKeyboardDevice; extern PTHREADINFO ptiRawInput; -extern BYTE gKeyStateTable[0x100]; +extern BYTE gafAsyncKeyState[0x100]; diff --git a/reactos/subsystems/win32/win32k/ntuser/accelerator.c b/reactos/subsystems/win32/win32k/ntuser/accelerator.c index 03e5fa836ea..1e20a83996d 100644 --- a/reactos/subsystems/win32/win32k/ntuser/accelerator.c +++ b/reactos/subsystems/win32/win32k/ntuser/accelerator.c @@ -110,7 +110,7 @@ co_IntTranslateAccelerator( &MenuItem, NULL); if (nPos != (UINT)-1) - hSubMenu = MenuItem->hSubMenu; + hSubMenu = SubMenu->head.h; else hMenu = NULL; } @@ -129,7 +129,7 @@ co_IntTranslateAccelerator( &MenuItem, NULL); if (nPos != (UINT)-1) - hSubMenu = MenuItem->hSubMenu; + hSubMenu = SubMenu->head.h; else hMenu = NULL; } @@ -138,7 +138,7 @@ co_IntTranslateAccelerator( /* If this is a menu item, there is no capturing enabled and window is not disabled, send WM_INITMENU */ if (hMenu && !IntGetCaptureWindow()) - { + { co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L); if (hSubMenu) { @@ -154,7 +154,7 @@ co_IntTranslateAccelerator( - this is window menu and window is minimized */ if (!(Window->style & WS_DISABLED) && !(hMenu && IntGetMenuState(hMenu, pAccel->cmd, MF_BYCOMMAND) & (MF_DISABLED|MF_GRAYED)) && - !(hMenu && hMenu == (HMENU)Window->IDMenu && !(Window->style & WS_MINIMIZED))) + !(hMenu && hMenu == (HMENU)Window->IDMenu && (Window->style & WS_MINIMIZED))) { /* If this is system menu item, send WM_SYSCOMMAND, otherwise send WM_COMMAND */ if (hMenu && hMenu == Window->SystemMenu) @@ -426,8 +426,7 @@ NtUserTranslateAccelerator( { if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i])) { - TRACE("NtUserTranslateAccelerator returns 1\n"); - RETURN( 1); + RETURN( 1); } /* Undocumented feature... */ @@ -441,7 +440,7 @@ CLEANUP: if (Window) UserDerefObjectCo(Window); if (Accel) UserDerefObjectCo(Accel); - TRACE("NtUserTranslateAccelerator returns 0\n"); + TRACE("NtUserTranslateAccelerator returns %d\n", _ret_); UserLeave(); END_CLEANUP; } diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 0842e227e34..1f5721916f6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -10,7 +10,6 @@ #include DBG_DEFAULT_CHANNEL(UserInput); -extern BYTE gKeyStateTable[]; extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread); extern PPROCESSINFO ppiScrnSaver; @@ -684,12 +683,12 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.lParam = MAKELPARAM(MousePos.x, MousePos.y); Msg.pt = MousePos; - if (gKeyStateTable[VK_SHIFT] & KS_DOWN_BIT) + if (gafAsyncKeyState[VK_SHIFT] & KS_DOWN_BIT) { Msg.wParam |= MK_SHIFT; } - if (gKeyStateTable[VK_CONTROL] & KS_DOWN_BIT) + if (gafAsyncKeyState[VK_CONTROL] & KS_DOWN_BIT) { Msg.wParam |= MK_CONTROL; } @@ -700,7 +699,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } if(mi->dwFlags & MOUSEEVENTF_LEFTDOWN) { - gKeyStateTable[VK_LBUTTON] |= KS_DOWN_BIT; + gafAsyncKeyState[VK_LBUTTON] |= KS_DOWN_BIT; Msg.message = SwapBtnMsg[0][SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; @@ -708,7 +707,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } else if(mi->dwFlags & MOUSEEVENTF_LEFTUP) { - gKeyStateTable[VK_LBUTTON] &= ~KS_DOWN_BIT; + gafAsyncKeyState[VK_LBUTTON] &= ~KS_DOWN_BIT; Msg.message = SwapBtnMsg[1][SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; @@ -716,7 +715,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) { - gKeyStateTable[VK_MBUTTON] |= KS_DOWN_BIT; + gafAsyncKeyState[VK_MBUTTON] |= KS_DOWN_BIT; Msg.message = WM_MBUTTONDOWN; CurInfo->ButtonsDown |= MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; @@ -724,7 +723,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP) { - gKeyStateTable[VK_MBUTTON] &= ~KS_DOWN_BIT; + gafAsyncKeyState[VK_MBUTTON] &= ~KS_DOWN_BIT; Msg.message = WM_MBUTTONUP; CurInfo->ButtonsDown &= ~MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; @@ -732,7 +731,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) { - gKeyStateTable[VK_RBUTTON] |= KS_DOWN_BIT; + gafAsyncKeyState[VK_RBUTTON] |= KS_DOWN_BIT; Msg.message = SwapBtnMsg[0][!SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; @@ -740,7 +739,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) } else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP) { - gKeyStateTable[VK_RBUTTON] &= ~KS_DOWN_BIT; + gafAsyncKeyState[VK_RBUTTON] &= ~KS_DOWN_BIT; Msg.message = SwapBtnMsg[1][!SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; @@ -759,14 +758,14 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = WM_XBUTTONDOWN; if(mi->mouseData & XBUTTON1) { - gKeyStateTable[VK_XBUTTON1] |= KS_DOWN_BIT; + gafAsyncKeyState[VK_XBUTTON1] |= KS_DOWN_BIT; CurInfo->ButtonsDown |= MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->mouseData & XBUTTON2) { - gKeyStateTable[VK_XBUTTON2] |= KS_DOWN_BIT; + gafAsyncKeyState[VK_XBUTTON2] |= KS_DOWN_BIT; CurInfo->ButtonsDown |= MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); @@ -777,14 +776,14 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = WM_XBUTTONUP; if(mi->mouseData & XBUTTON1) { - gKeyStateTable[VK_XBUTTON1] &= ~KS_DOWN_BIT; + gafAsyncKeyState[VK_XBUTTON1] &= ~KS_DOWN_BIT; CurInfo->ButtonsDown &= ~MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->mouseData & XBUTTON2) { - gKeyStateTable[VK_XBUTTON2] &= ~KS_DOWN_BIT; + gafAsyncKeyState[VK_XBUTTON2] &= ~KS_DOWN_BIT; CurInfo->ButtonsDown &= ~MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); diff --git a/reactos/subsystems/win32/win32k/ntuser/keyboard.c b/reactos/subsystems/win32/win32k/ntuser/keyboard.c index 4c4077e8bed..e02bccd4ade 100644 --- a/reactos/subsystems/win32/win32k/ntuser/keyboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/keyboard.c @@ -10,7 +10,7 @@ #include DBG_DEFAULT_CHANNEL(UserKbd); -BYTE gKeyStateTable[0x100]; +BYTE gafAsyncKeyState[0x100]; static PKEYBOARD_INDICATOR_TRANSLATION gpKeyboardIndicatorTrans = NULL; /* FUNCTIONS *****************************************************************/ @@ -25,7 +25,7 @@ NTSTATUS NTAPI InitKeyboardImpl(VOID) { - RtlZeroMemory(&gKeyStateTable, sizeof(gKeyStateTable)); + RtlZeroMemory(&gafAsyncKeyState, sizeof(gafAsyncKeyState)); return STATUS_SUCCESS; } @@ -636,9 +636,9 @@ IntGetAsyncKeyState(DWORD dwKey) if (dwKey < 0x100) { - if (gKeyStateTable[dwKey] & KS_DOWN_BIT) + if (gafAsyncKeyState[dwKey] & KS_DOWN_BIT) dwRet |= 0xFFFF8000; // If down, windows returns 0xFFFF8000. - if (gKeyStateTable[dwKey] & KS_LOCK_BIT) + if (gafAsyncKeyState[dwKey] & KS_LOCK_BIT) dwRet |= 0x1; } else @@ -783,20 +783,20 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) /* Get virtual key without shifts (VK_(L|R)* -> VK_*) */ wSimpleVk = IntSimplifyVk(wVk); wVkOtherSide = IntGetVkOtherSide(wVk); - PrevKeyState = gKeyStateTable[wSimpleVk]; + PrevKeyState = gafAsyncKeyState[wSimpleVk]; /* Update global keyboard state. Begin from lock bit */ if (!bKeyUp && !(PrevKeyState & KS_DOWN_BIT)) - gKeyStateTable[wVk] ^= KS_LOCK_BIT; + gafAsyncKeyState[wVk] ^= KS_LOCK_BIT; /* Update down bit */ if (bKeyUp) - gKeyStateTable[wVk] &= ~KS_DOWN_BIT; + gafAsyncKeyState[wVk] &= ~KS_DOWN_BIT; else - gKeyStateTable[wVk] |= KS_DOWN_BIT; + gafAsyncKeyState[wVk] |= KS_DOWN_BIT; /* Update key without shifts */ - gKeyStateTable[wSimpleVk] = gKeyStateTable[wVk] | gKeyStateTable[wVkOtherSide]; + gafAsyncKeyState[wSimpleVk] = gafAsyncKeyState[wVk] | gafAsyncKeyState[wVkOtherSide]; if (!bKeyUp) { @@ -806,7 +806,7 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) if (gpKeyboardIndicatorTrans) IntKeyboardUpdateLeds(ghKeyboardDevice, wScanCode, - gKeyStateTable[wSimpleVk] & KS_LOCK_BIT, + gafAsyncKeyState[wSimpleVk] & KS_LOCK_BIT, gpKeyboardIndicatorTrans); } @@ -818,12 +818,12 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) { if (wVk == VK_LWIN || wVk == VK_RWIN) IntKeyboardSendWinKeyMsg(); - else if(wSimpleVk == VK_MENU && !(gKeyStateTable[VK_CONTROL] & KS_DOWN_BIT)) + else if(wSimpleVk == VK_MENU && !(gafAsyncKeyState[VK_CONTROL] & KS_DOWN_BIT)) co_IntKeyboardSendAltKeyMsg(); } /* Check if it is a hotkey */ - fModifiers = IntGetModifiers(gKeyStateTable); + fModifiers = IntGetModifiers(gafAsyncKeyState); if (GetHotKey(fModifiers, wSimpleVk, &Thread, &hWnd, &HotkeyId)) { if (!bKeyUp) @@ -848,8 +848,8 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) wSysKey = (pKbdTbl->fLocaleFlags & KLLF_ALTGR) ? VK_LMENU : VK_MENU; if (wVk == VK_F10 || //uVkNoShift == VK_MENU || // FIXME: If only LALT is pressed WM_SYSKEYUP is generated instead of WM_KEYUP - ((gKeyStateTable[wSysKey] & KS_DOWN_BIT) && // FIXME - !(gKeyStateTable[VK_CONTROL] & KS_DOWN_BIT))) + ((gafAsyncKeyState[wSysKey] & KS_DOWN_BIT) && // FIXME + !(gafAsyncKeyState[VK_CONTROL] & KS_DOWN_BIT))) { if (bKeyUp) Msg.message = WM_SYSKEYUP; @@ -870,7 +870,7 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) { if (bExt) Msg.lParam |= LP_EXT_BIT; - if (gKeyStateTable[VK_MENU] & KS_DOWN_BIT) + if (gafAsyncKeyState[VK_MENU] & KS_DOWN_BIT) Msg.lParam |= LP_CONTEXT_BIT; if (PrevKeyState & KS_DOWN_BIT) Msg.lParam |= LP_PREV_STATE_BIT; @@ -947,7 +947,7 @@ UserProcessKeyboardInput( KEYBDINPUT KbdInput; /* Support numlock */ - if ((wVk & KBDNUMPAD) && (gKeyStateTable[VK_NUMLOCK] & KS_LOCK_BIT)) + if ((wVk & KBDNUMPAD) && (gafAsyncKeyState[VK_NUMLOCK] & KS_LOCK_BIT)) { wVk = IntTranslateNumpadKey(wVk & 0xFF); } @@ -1451,19 +1451,19 @@ UserGetMouseButtonsState(VOID) if (gpsi->aiSysMet[SM_SWAPBUTTON]) { - if (gKeyStateTable[VK_RBUTTON] & KS_DOWN_BIT) ret |= MK_LBUTTON; - if (gKeyStateTable[VK_LBUTTON] & KS_DOWN_BIT) ret |= MK_RBUTTON; + if (gafAsyncKeyState[VK_RBUTTON] & KS_DOWN_BIT) ret |= MK_LBUTTON; + if (gafAsyncKeyState[VK_LBUTTON] & KS_DOWN_BIT) ret |= MK_RBUTTON; } else { - if (gKeyStateTable[VK_LBUTTON] & KS_DOWN_BIT) ret |= MK_LBUTTON; - if (gKeyStateTable[VK_RBUTTON] & KS_DOWN_BIT) ret |= MK_RBUTTON; + if (gafAsyncKeyState[VK_LBUTTON] & KS_DOWN_BIT) ret |= MK_LBUTTON; + if (gafAsyncKeyState[VK_RBUTTON] & KS_DOWN_BIT) ret |= MK_RBUTTON; } - if (gKeyStateTable[VK_MBUTTON] & KS_DOWN_BIT) ret |= MK_MBUTTON; - if (gKeyStateTable[VK_SHIFT] & KS_DOWN_BIT) ret |= MK_SHIFT; - if (gKeyStateTable[VK_CONTROL] & KS_DOWN_BIT) ret |= MK_CONTROL; - if (gKeyStateTable[VK_XBUTTON1] & KS_DOWN_BIT) ret |= MK_XBUTTON1; - if (gKeyStateTable[VK_XBUTTON2] & KS_DOWN_BIT) ret |= MK_XBUTTON2; + if (gafAsyncKeyState[VK_MBUTTON] & KS_DOWN_BIT) ret |= MK_MBUTTON; + if (gafAsyncKeyState[VK_SHIFT] & KS_DOWN_BIT) ret |= MK_SHIFT; + if (gafAsyncKeyState[VK_CONTROL] & KS_DOWN_BIT) ret |= MK_CONTROL; + if (gafAsyncKeyState[VK_XBUTTON1] & KS_DOWN_BIT) ret |= MK_XBUTTON1; + if (gafAsyncKeyState[VK_XBUTTON2] & KS_DOWN_BIT) ret |= MK_XBUTTON2; return ret; } diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index a3a125457eb..ead730cd4b4 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -1930,7 +1930,7 @@ MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQu MessageQueue->NewMessagesHandle = NULL; MessageQueue->ShowingCursor = 0; MessageQueue->CursorObject = NULL; - RtlCopyMemory(MessageQueue->KeyState, gKeyStateTable, sizeof(gKeyStateTable)); + RtlCopyMemory(MessageQueue->KeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState)); Status = ZwCreateEvent(&MessageQueue->NewMessagesHandle, EVENT_ALL_ACCESS, NULL, SynchronizationEvent, FALSE); -- 2.17.1