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)
{
fShiftKeyDown = bKeyDown;
// return;
}
if (key == KEY_CTRL)
{
fCtrlKeyDown = bKeyDown;
// return;
}
if (key == KEY_CAPSLOCK)
{
// Keyboards toggle the light on key-down, so I'm going with that.
if (bKeyDown && !bKeyRepeat)
if (!bKeyRepeat)
{
fCapsLockLock = !fCapsLockLock;
fCapsLockLock = (GetKeyState(KEY_CAPSLOCK) & 1) == 1;
plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock);
}
}
@ -206,7 +203,8 @@ void plKeyboardDevice::HandleWindowActivate(bool bActive, HWND hWnd)
{
if (bActive)
{
fCtrlKeyDown = false;
// Refresh the caps lock state
HandleKeyEvent(KEYDOWN, KEY_CAPSLOCK, nil, false);
}
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)
break;
UINT scan = Lparam >> 16;
scan = MapVirtualKeyEx(scan, MAPVK_VSC_TO_VK, nil);
if (scan == 0) scan = -1;
BYTE scan = Lparam >> 16;
UINT vkey = MapVirtualKey(scan, MAPVK_VSC_TO_VK);
bExtended = Lparam >> 24 & 1;
hsBool bRepeat = ((Lparam >> 29) & 0xf) != 0;
bool down = !(Lparam >> 31);
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;
case MOUSEWHEEL:

Loading…
Cancel
Save