diff --git a/source/Frame.cpp b/source/Frame.cpp index ee031b02..245245bf 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -1394,7 +1394,7 @@ LRESULT CALLBACK FrameWndProc ( // Note about Alt Gr (Right-Alt): // . WM_KEYDOWN[Left-Control], then: // . WM_KEYDOWN[Right-Alt] - BOOL extended = (HIWORD(lparam) & KF_EXTENDED) != 0; + bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0; BOOL down = 1; BOOL autorep = (HIWORD(lparam) & KF_REPEAT) != 0; BOOL IsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep); @@ -1403,8 +1403,8 @@ LRESULT CALLBACK FrameWndProc ( { KeybQueueKeypress((int)wparam, NOT_ASCII); - if ((HIWORD(lparam) & KF_REPEAT) == 0) - KeybAnyKeyDown(WM_KEYDOWN, wparam); + if (!autorep) + KeybAnyKeyDown(WM_KEYDOWN, wparam, extended); } } else if (g_nAppMode == MODE_DEBUG) @@ -1426,13 +1426,13 @@ LRESULT CALLBACK FrameWndProc ( } else { - BOOL extended = (HIWORD(lparam) & KF_EXTENDED) != 0; + bool extended = (HIWORD(lparam) & KF_EXTENDED) != 0; BOOL down = 0; BOOL autorep = 0; BOOL bIsJoyKey = JoyProcessKey((int)wparam, extended, down, autorep); if (!bIsJoyKey) - KeybAnyKeyDown(WM_KEYUP, wparam); + KeybAnyKeyDown(WM_KEYUP, wparam, extended); } break; diff --git a/source/Keyboard.cpp b/source/Keyboard.cpp index ce02585b..70146809 100644 --- a/source/Keyboard.cpp +++ b/source/Keyboard.cpp @@ -390,11 +390,13 @@ static char ClipboardCurrChar(bool bIncPtr) //=========================================================================== -static uint64_t g_AKDFlags[4] = {0,0,0,0}; +const UINT kAKDNumElements = 256/64; +static uint64_t g_AKDFlags[2][kAKDNumElements] = { {0,0,0,0}, // normal + {0,0,0,0}}; // extended // NB. Don't need to be concerned about if numpad/cursors are used for joystick, // since parent calls JoyProcessKey() just before this. -void KeybAnyKeyDown(UINT message, WPARAM wparam) +void KeybAnyKeyDown(UINT message, WPARAM wparam, bool bIsExtended) { if (wparam > 255) { @@ -419,17 +421,24 @@ void KeybAnyKeyDown(UINT message, WPARAM wparam) { UINT offset = wparam >> 6; UINT bit = wparam & 0x3f; + UINT idx = !bIsExtended ? 0 : 1; if (message == WM_KEYDOWN) - g_AKDFlags[offset] |= (1LL<