1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 18:59:09 +00:00

Refresh CapsLock state on window restore

This fixes an unreported bug where the avatar run-lock state can get
confused after alt-tabbing. The other key states are too volatile to
update... We never get the depressed events if they are pressed on window
activation.
This commit is contained in:
2011-10-20 19:20:03 -04:00
parent 6582d0261e
commit 6c4ec930b0

View File

@ -157,19 +157,16 @@ void plKeyboardDevice::HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDo
if (key == KEY_SHIFT) if (key == KEY_SHIFT)
{ {
fShiftKeyDown = bKeyDown; fShiftKeyDown = bKeyDown;
// return;
} }
if (key == KEY_CTRL) if (key == KEY_CTRL)
{ {
fCtrlKeyDown = bKeyDown; fCtrlKeyDown = bKeyDown;
// return;
} }
if (key == KEY_CAPSLOCK) if (key == KEY_CAPSLOCK)
{ {
// Keyboards toggle the light on key-down, so I'm going with that. if (!bKeyRepeat)
if (bKeyDown && !bKeyRepeat)
{ {
fCapsLockLock = !fCapsLockLock; fCapsLockLock = (GetKeyState(KEY_CAPSLOCK) & 1) == 1;
plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock); plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock);
} }
} }
@ -190,7 +187,8 @@ void plKeyboardDevice::HandleWindowActivate(bool bActive, HWND hWnd)
{ {
if (bActive) if (bActive)
{ {
fCtrlKeyDown = false; // Refresh the caps lock state
HandleKeyEvent(KEYDOWN, KEY_CAPSLOCK, nil, false);
} }
else else
{ {