mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Filter WM_CHAR messages with control characters. Fix multiline edit input for keyboard layouts using alt key
This commit is contained in:
@ -1035,9 +1035,6 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, uint8_t modifiers )
|
||||
if ((fPrevCtrl || fNextCtrl) && (fLineStarts.GetCount() <= GetFirstVisibleLine()))
|
||||
return true; // we're ignoring if we can't actually edit our visible frame (and we're linked)
|
||||
|
||||
if (modifiers & pfGameGUIMgr::kCtrlDown)
|
||||
return true; // we're ignoring ctrl key events
|
||||
|
||||
if( fIgnoreNextKey )
|
||||
{
|
||||
// So we don't process keys that already got handled by HandleKeyEvent()
|
||||
@ -1111,6 +1108,13 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, p
|
||||
return true;
|
||||
|
||||
DeleteChar();
|
||||
}
|
||||
else if( key == KEY_ENTER )
|
||||
{
|
||||
if( IsLocked() )
|
||||
return true;
|
||||
|
||||
InsertChar('\n');
|
||||
}
|
||||
else if( key == KEY_ESCAPE )
|
||||
{
|
||||
|
@ -119,7 +119,8 @@ plInputManager* plInputManager::fInstance = nil;
|
||||
|
||||
plInputManager::plInputManager( hsWindowHndl hWnd ) :
|
||||
fDInputMgr(nil),
|
||||
fInterfaceMgr(nil)
|
||||
fInterfaceMgr(nil),
|
||||
localeC("C")
|
||||
{
|
||||
fhWnd = hWnd;
|
||||
fInstance = this;
|
||||
@ -289,9 +290,11 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
|
||||
break;
|
||||
case CHAR_MSG:
|
||||
{
|
||||
wchar_t ch = (wchar_t)Wparam;
|
||||
|
||||
// These are handled by KEYUP/KEYDOWN and should not be sent
|
||||
// We don't like garbage getting in string fields
|
||||
if (Wparam == KEY_BACKSPACE || Wparam == KEY_ESCAPE)
|
||||
if (std::iscntrl(ch, localeC))
|
||||
break;
|
||||
|
||||
BYTE scan = (BYTE)(Lparam >> 16);
|
||||
@ -300,10 +303,7 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
|
||||
bExtended = Lparam >> 24 & 1;
|
||||
hsBool bRepeat = ((Lparam >> 29) & 0xf) != 0;
|
||||
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++)
|
||||
fInputDevices[i]->HandleKeyEvent( CHAR_MSG, (plKeyDef)vkey, down, bRepeat, ch );
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsTemplates.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "pnInputCore/plInputMap.h"
|
||||
#include <locale>
|
||||
|
||||
class plDInputMgr;
|
||||
class plInputDevice;
|
||||
@ -99,6 +100,7 @@ protected:
|
||||
float fMouseScale;
|
||||
static uint8_t bRecenterMouse;
|
||||
static hsWindowHndl fhWnd;
|
||||
std::locale localeC;
|
||||
|
||||
public:
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
Reference in New Issue
Block a user