Browse Source

Include the vkey code with the key character

Adam Johnson 13 years ago
parent
commit
a75220a409
  1. 16
      Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp
  2. 6
      Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp

16
Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp

@ -72,6 +72,7 @@ class pfConsoleInputInterface : public plInputInterface
pfConsole *fConsole; pfConsole *fConsole;
virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ) virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd )
{ {
if( cmd->fControlCode == B_SET_CONSOLE_MODE ) if( cmd->fControlCode == B_SET_CONSOLE_MODE )
@ -99,7 +100,7 @@ class pfConsoleInputInterface : public plInputInterface
public: public:
pfConsoleInputInterface( pfConsole *console ) pfConsoleInputInterface( pfConsole *console )
{ {
fConsole = console; fConsole = console;
SetEnabled( true ); // Always enabled SetEnabled( true ); // Always enabled
@ -126,12 +127,19 @@ class pfConsoleInputInterface : public plInputInterface
virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ) virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg )
{ {
plKeyEventMsg *keyMsg = plKeyEventMsg::ConvertNoRef( pMsg ); plKeyEventMsg *keyMsg = plKeyEventMsg::ConvertNoRef( pMsg );
if( keyMsg != nil )
// 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( fConsole->fMode ) 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 ); fConsole->IHandleKey( keyMsg );
return true; return true;
} }

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

@ -281,11 +281,15 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
Wparam == KEY_TAB || Wparam == 0x0D) Wparam == KEY_TAB || Wparam == 0x0D)
break; break;
UINT scan = Lparam >> 16;
scan = MapVirtualKeyEx(scan, MAPVK_VSC_TO_VK, nil);
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)-1, down, bRepeat, (wchar_t)Wparam ); fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)scan, down, bRepeat, (wchar_t)Wparam );
} }
break; break;
case MOUSEWHEEL: case MOUSEWHEEL:

Loading…
Cancel
Save