diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-23 07:58:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-23 07:58:04 +0400 |
commit | 3b71cab420c642df30d9f9addee166444ce5b85b (patch) | |
tree | 50b3a4dfc9fcbb9473e65d5ab7d78b67c38c423c /source/gameengine/GamePlayer | |
parent | c02c2dfdd911fd1c92236e810f26da13f79cf8a5 (diff) |
Fix T38110: GameEngine keyboard sensor ignores unicode characters
Diffstat (limited to 'source/gameengine/GamePlayer')
5 files changed, 14 insertions, 12 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp index ecb58eda78e..0821d1d3b23 100644 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp +++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp @@ -64,7 +64,7 @@ void GPC_KeyboardDevice::NextFrame() * ConvertBPEvent translates Windows keyboard events into ketsji kbd events. * Extra event information is stored, like ramp-mode (just released/pressed) */ -bool GPC_KeyboardDevice::ConvertEvent(int incode, int val) +bool GPC_KeyboardDevice::ConvertEvent(int incode, int val, unsigned int unicode) { bool result = false; @@ -83,6 +83,7 @@ bool GPC_KeyboardDevice::ConvertEvent(int incode, int val) // todo: convert val ?? m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? + m_eventStatusTables[m_currentTable][kxevent].m_unicode = unicode ; switch (m_eventStatusTables[previousTable][kxevent].m_status) { diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h index c082bc1b82f..d9842a42e0a 100644 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h +++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h @@ -82,7 +82,7 @@ public: return m_reverseKeyTranslateTable[incode]; } - virtual bool ConvertEvent(int incode, int val); + virtual bool ConvertEvent(int incode, int val, unsigned int unicode); virtual void HookEscape(); }; diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp index e38a9e3d6cb..94045d532af 100644 --- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp +++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp @@ -97,19 +97,19 @@ bool GPC_MouseDevice::ConvertButtonEvent(TButtonId button, bool isDown) switch (button) { case buttonLeft: - result = ConvertEvent(KX_LEFTMOUSE, isDown); + result = ConvertEvent(KX_LEFTMOUSE, isDown, 0); break; case buttonMiddle: - result = ConvertEvent(KX_MIDDLEMOUSE, isDown); + result = ConvertEvent(KX_MIDDLEMOUSE, isDown, 0); break; case buttonRight: - result = ConvertEvent(KX_RIGHTMOUSE, isDown); + result = ConvertEvent(KX_RIGHTMOUSE, isDown, 0); break; case buttonWheelUp: - result = ConvertEvent(KX_WHEELUPMOUSE, isDown); + result = ConvertEvent(KX_WHEELUPMOUSE, isDown, 0); break; case buttonWheelDown: - result = ConvertEvent(KX_WHEELDOWNMOUSE, isDown); + result = ConvertEvent(KX_WHEELDOWNMOUSE, isDown, 0); break; default: // Should not happen! @@ -144,16 +144,16 @@ bool GPC_MouseDevice::ConvertMoveEvent(int x, int y) bool result; // Convert to local coordinates? - result = ConvertEvent(KX_MOUSEX, x); + result = ConvertEvent(KX_MOUSEX, x, 0); if (result) { - result = ConvertEvent(KX_MOUSEY, y); + result = ConvertEvent(KX_MOUSEY, y, 0); } return result; } -bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval) +bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned int unicode) { bool result = true; diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h index b092fbd21dd..504df2376bb 100644 --- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h +++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h @@ -99,7 +99,7 @@ protected: * \param eventval Value for this event. * \return Indication as to whether the event was processed. */ - virtual bool ConvertEvent(KX_EnumInputs kxevent, int eventval); + virtual bool ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned int unicode); }; #endif /* __GPC_MOUSEDEVICE_H__ */ diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index ac96ca097ad..1ce6650831e 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -951,11 +951,12 @@ bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown) { GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData); + unsigned int unicode = keyData->utf8_buf[0] ? BLI_str_utf8_as_unicode(keyData->utf8_buf) : keyData->ascii; if (m_keyboard->ToNative(keyData->key) == KX_KetsjiEngine::GetExitKey() && !m_keyboard->m_hookesc && !m_isEmbedded) { m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; } - m_keyboard->ConvertEvent(keyData->key, isDown); + m_keyboard->ConvertEvent(keyData->key, isDown, unicode); handled = true; } return handled; |