From a75220a409ef1b403e2b7a2bc7b4910639c777de Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 27 Aug 2011 14:22:53 -0400 Subject: [PATCH] Include the vkey code with the key character --- .../Plasma/FeatureLib/pfConsole/pfConsole.cpp | 16 ++++++++++++---- .../PubUtilLib/plInputCore/plInputManager.cpp | 6 +++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp index 50bff0d3..6ab878f1 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp @@ -72,6 +72,7 @@ class pfConsoleInputInterface : public plInputInterface pfConsole *fConsole; + virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ) { if( cmd->fControlCode == B_SET_CONSOLE_MODE ) @@ -99,7 +100,7 @@ class pfConsoleInputInterface : public plInputInterface public: - pfConsoleInputInterface( pfConsole *console ) + pfConsoleInputInterface( pfConsole *console ) { fConsole = console; SetEnabled( true ); // Always enabled @@ -126,12 +127,19 @@ class pfConsoleInputInterface : public plInputInterface virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ) { plKeyEventMsg *keyMsg = plKeyEventMsg::ConvertNoRef( pMsg ); - - // HACK for now to let runlock work always (until we can think of a more generic and good way of doing this) - if( keyMsg != nil && keyMsg->GetKeyCode() != KEY_CAPSLOCK ) + if( keyMsg != nil ) { if( fConsole->fMode ) { + // If this is a character input, do not accept the codes (yes, the code) that will toggle + // the console--that's handled elsewhere... + if ( keyMsg->GetKeyChar() ) + { + const plKeyBinding* keyb = fControlMap->FindBinding( B_SET_CONSOLE_MODE ); + if ( keyb->GetKey1().fKey == keyMsg->GetKeyCode() ) + return true; + } + fConsole->IHandleKey( keyMsg ); return true; } diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp index 20c4ef6e..5cd7c8f7 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp @@ -281,11 +281,15 @@ 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; + bExtended = Lparam >> 24 & 1; hsBool bRepeat = ((Lparam >> 29) & 0xf) != 0; bool down = !(Lparam >> 31); for (int i=0; iHandleKeyEvent( CHAR_MSG, (plKeyDef)-1, down, bRepeat, (wchar_t)Wparam ); + fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)scan, down, bRepeat, (wchar_t)Wparam ); } break; case MOUSEWHEEL: