Browse Source

Fix use of the return key as a control key

broken by revision f251606
Christian Walther 13 years ago
parent
commit
859aef9e97
  1. 4
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
  2. 10
      Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp

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

@ -186,10 +186,6 @@ void plKeyboardDevice::HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDo
plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock); plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock);
} }
} }
if (key == KEY_ENTER)
{
c = '\n';
}
// send a key event... // send a key event...
plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg; plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg;

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

@ -293,8 +293,8 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
{ {
// These are handled by KEYUP/KEYDOWN and should not be sent // These are handled by KEYUP/KEYDOWN and should not be sent
// We don't like garbage getting in string fields // We don't like garbage getting in string fields
if (Wparam == KEY_BACKSPACE || Wparam == 0x0A || Wparam == KEY_ESCAPE || if (Wparam == KEY_BACKSPACE || Wparam == KEY_ESCAPE ||
Wparam == KEY_TAB || Wparam == 0x0D) Wparam == KEY_TAB)
break; break;
BYTE scan = Lparam >> 16; BYTE scan = Lparam >> 16;
@ -303,8 +303,12 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
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);
wchar_t ch = (wchar_t)Wparam;
// for the return key, Windows sends CR, but multiline text input fields want LF (CR is rendered as a wide horizontal space)
if (ch == 0x0D)
ch = 0x0A;
for (int i=0; i<fInputDevices.Count(); i++) for (int i=0; i<fInputDevices.Count(); i++)
fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)vkey, down, bRepeat, (wchar_t)Wparam ); fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)vkey, down, bRepeat, ch );
} }
break; break;
case MOUSEWHEEL: case MOUSEWHEEL:

Loading…
Cancel
Save