From 5194505407884f6375311f0ab4c5f8783646cb91 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 1 Sep 2012 18:02:29 +0300 Subject: Fix GUIKeyChangeMenu so that '/' can be inserted on a finnish keyboard --- src/keycode.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/keycode.cpp') diff --git a/src/keycode.cpp b/src/keycode.cpp index 5a8df0db4..cdf3c6062 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -288,16 +288,27 @@ KeyPress::KeyPress(const char *name) m_name = name[0]; } -KeyPress::KeyPress(const irr::SEvent::SKeyInput &in) +KeyPress::KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character) { Key = in.Key; Char = in.Char; + + if(prefer_character){ + m_name.resize(MB_CUR_MAX+1, '\0'); + int written = wctomb(&m_name[0], Char); + if(written > 0){ + infostream<<"KeyPress: Preferring character for "<= 0){ + if(written < 0){ std::string hexstr = hex_encode((const char*)&Char, sizeof(Char)); errorstream<<"KeyPress: Unexpected multibyte character "<