Author: rharabien
Date: Sat Oct 8 23:33:26 2011
New Revision: 54058
URL:
http://svn.reactos.org/svn/reactos?rev=54058&view=rev
Log:
[WIN32K]
- Rename gKeyStateTable to gafAsyncKeyState: it's a proper name
- Fix accelerators regression
Modified:
trunk/reactos/subsystems/win32/win32k/include/input.h
trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Sat Oct 8 23:33:26
2011
@@ -56,4 +56,4 @@
extern HANDLE ghKeyboardDevice;
extern PTHREADINFO ptiRawInput;
-extern BYTE gKeyStateTable[0x100];
+extern BYTE gafAsyncKeyState[0x100];
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/accelerator.c [iso-8859-1] Sat Oct 8
23:33:26 2011
@@ -110,7 +110,7 @@
&MenuItem,
NULL);
if (nPos != (UINT)-1)
- hSubMenu = MenuItem->hSubMenu;
+ hSubMenu = SubMenu->head.h;
else
hMenu = NULL;
}
@@ -129,7 +129,7 @@
&MenuItem,
NULL);
if (nPos != (UINT)-1)
- hSubMenu = MenuItem->hSubMenu;
+ hSubMenu = SubMenu->head.h;
else
hMenu = NULL;
}
@@ -138,7 +138,7 @@
/* 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 @@
- 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 @@
{
if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
{
- TRACE("NtUserTranslateAccelerator returns 1\n");
- RETURN( 1);
+ RETURN( 1);
}
/* Undocumented feature... */
@@ -441,7 +440,7 @@
if (Window) UserDerefObjectCo(Window);
if (Accel) UserDerefObjectCo(Accel);
- TRACE("NtUserTranslateAccelerator returns 0\n");
+ TRACE("NtUserTranslateAccelerator returns %d\n", _ret_);
UserLeave();
END_CLEANUP;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Sat Oct 8 23:33:26
2011
@@ -10,7 +10,6 @@
#include <win32k.h>
DBG_DEFAULT_CHANNEL(UserInput);
-extern BYTE gKeyStateTable[];
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
extern PPROCESSINFO ppiScrnSaver;
@@ -684,12 +683,12 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Sat Oct 8
23:33:26 2011
@@ -10,7 +10,7 @@
#include <win32k.h>
DBG_DEFAULT_CHANNEL(UserKbd);
-BYTE gKeyStateTable[0x100];
+BYTE gafAsyncKeyState[0x100];
static PKEYBOARD_INDICATOR_TRANSLATION gpKeyboardIndicatorTrans = NULL;
/* FUNCTIONS *****************************************************************/
@@ -25,7 +25,7 @@
NTAPI
InitKeyboardImpl(VOID)
{
- RtlZeroMemory(&gKeyStateTable, sizeof(gKeyStateTable));
+ RtlZeroMemory(&gafAsyncKeyState, sizeof(gafAsyncKeyState));
return STATUS_SUCCESS;
}
@@ -636,9 +636,9 @@
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 @@
/* 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 @@
if (gpKeyboardIndicatorTrans)
IntKeyboardUpdateLeds(ghKeyboardDevice,
wScanCode,
- gKeyStateTable[wSimpleVk] & KS_LOCK_BIT,
+ gafAsyncKeyState[wSimpleVk] & KS_LOCK_BIT,
gpKeyboardIndicatorTrans);
}
@@ -818,12 +818,12 @@
{
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 @@
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 @@
{
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 @@
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 @@
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 (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_LBUTTON] & KS_DOWN_BIT) ret |= MK_LBUTTON;
+ if (gafAsyncKeyState[VK_RBUTTON] & KS_DOWN_BIT) ret |= MK_RBUTTON;
+ }
+ 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;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Oct 8
23:33:26 2011
@@ -1930,7 +1930,7 @@
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);