Browse Source

Merge pull request #83 from Hoikas/moar-input

More input fixes
Branan Purvine-Riley 13 years ago
parent
commit
4255823e5d
  1. 10
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
  2. 7
      Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp

10
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp

@ -173,19 +173,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);
} }
} }
@ -206,7 +203,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
{ {

7
Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp

@ -297,15 +297,14 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
Wparam == KEY_TAB || Wparam == 0x0D) Wparam == KEY_TAB || Wparam == 0x0D)
break; break;
UINT scan = Lparam >> 16; BYTE scan = Lparam >> 16;
scan = MapVirtualKeyEx(scan, MAPVK_VSC_TO_VK, nil); UINT vkey = MapVirtualKey(scan, MAPVK_VSC_TO_VK);
if (scan == 0) scan = -1;
bExtended = Lparam >> 24 & 1; bExtended = Lparam >> 24 & 1;
hsBool bRepeat = ((Lparam >> 29) & 0xf) != 0; hsBool bRepeat = ((Lparam >> 29) & 0xf) != 0;
bool down = !(Lparam >> 31); bool down = !(Lparam >> 31);
for (int i=0; i<fInputDevices.Count(); i++) for (int i=0; i<fInputDevices.Count(); i++)
fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)scan, down, bRepeat, (wchar_t)Wparam ); fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)vkey, down, bRepeat, (wchar_t)Wparam );
} }
break; break;
case MOUSEWHEEL: case MOUSEWHEEL:

Loading…
Cancel
Save