diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index d56e2ca8..f761a13d 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -218,9 +218,28 @@ int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) { void CIrrDeviceSDL::resetReceiveTextInputEvents() { gui::IGUIElement *elem = GUIEnvironment->getFocus(); if (elem && elem->acceptsIME()) - SDL_StartTextInput(); + { + // IBus seems to have an issue where dead keys and compose keys do not + // work (specifically, the individual characters in the sequence are + // sent as text input events instead of the result) when + // SDL_StartTextInput() is called on the same input box. + core::rect pos = elem->getAbsolutePosition(); + if (!SDL_IsTextInputActive() || lastElemPos != pos) + { + lastElemPos = pos; + SDL_Rect rect; + rect.x = pos.UpperLeftCorner.X; + rect.y = pos.UpperLeftCorner.Y; + rect.w = pos.getWidth(); + rect.h = pos.getHeight(); + SDL_SetTextInputRect(&rect); + SDL_StartTextInput(); + } + } else + { SDL_StopTextInput(); + } } //! constructor diff --git a/source/Irrlicht/CIrrDeviceSDL.h b/source/Irrlicht/CIrrDeviceSDL.h index 1713a3b9..ebd8e032 100644 --- a/source/Irrlicht/CIrrDeviceSDL.h +++ b/source/Irrlicht/CIrrDeviceSDL.h @@ -303,6 +303,8 @@ namespace irr bool Resizable; + core::rect lastElemPos; + struct SKeyMap { SKeyMap() {}