Fix for Win32 keyboard driver key states
This commit is contained in:
parent
025cef93cc
commit
f1a34c9852
@ -31,6 +31,7 @@ FIX: Minor code improvements
|
|||||||
FEATURE: Add cmake support
|
FEATURE: Add cmake support
|
||||||
FIX: Add missing driver.mk to SSD1322 driver.
|
FIX: Add missing driver.mk to SSD1322 driver.
|
||||||
FEATURE: LGDP4532 driver improvements.
|
FEATURE: LGDP4532 driver improvements.
|
||||||
|
FIX: Win32 Keyboard driver now retrieves lock key states on window activate
|
||||||
|
|
||||||
|
|
||||||
*** Release 2.9 ***
|
*** Release 2.9 ***
|
||||||
|
@ -647,12 +647,30 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD
|
#if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD
|
||||||
|
case WM_ACTIVATE:
|
||||||
|
// Copy the lock key states into the uGFX keyboard as it might have changed while we were away
|
||||||
|
// For simplicity we do this on both activate and deactivate.
|
||||||
|
if (keyboard && keyboard->pLayout) {
|
||||||
|
if (GetKeyState(VK_NUMLOCK) & 1)
|
||||||
|
keyboard->keystate |= GKEYSTATE_NUMLOCK;
|
||||||
|
else
|
||||||
|
keyboard->keystate &= ~GKEYSTATE_NUMLOCK;
|
||||||
|
if (GetKeyState(VK_CAPITAL) & 1)
|
||||||
|
keyboard->keystate |= GKEYSTATE_CAPSLOCK;
|
||||||
|
else
|
||||||
|
keyboard->keystate &= ~GKEYSTATE_CAPSLOCK;
|
||||||
|
if (GetKeyState(VK_SCROLL) & 1)
|
||||||
|
keyboard->keystate |= GKEYSTATE_SCROLLLOCK;
|
||||||
|
else
|
||||||
|
keyboard->keystate &= ~GKEYSTATE_SCROLLLOCK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
// A layout is being used: Send scan codes to the keyboard buffer
|
// A layout is being used: Send scan codes to the keyboard buffer
|
||||||
if (keyboard && keyboard->pLayout && keypos < (int)sizeof(keybuffer)-1 && (wParam & 0xFF) > 0x01) {
|
if (keyboard && keyboard->pLayout && keypos < (int)sizeof(keybuffer)-1 && (wParam & 0xFF) >= VK_BACK) {
|
||||||
if (Msg == WM_KEYUP || Msg == WM_SYSKEYUP)
|
if (Msg == WM_KEYUP || Msg == WM_SYSKEYUP)
|
||||||
keybuffer[keypos++] = 0x00; // Keyup
|
keybuffer[keypos++] = 0x00; // Keyup
|
||||||
else if (HIWORD(lParam) & KF_REPEAT)
|
else if (HIWORD(lParam) & KF_REPEAT)
|
||||||
|
Loading…
Reference in New Issue
Block a user