From eca3f0b6beb4933a7b745bf75aa4a235f10dd4f9 Mon Sep 17 00:00:00 2001 From: y5nw <37980625+y5nw@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:57:45 +0100 Subject: [PATCH] [SDL] Set text input rectangle for IMEs --- source/Irrlicht/CIrrDeviceSDL.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index d56e2ca8..37235ed6 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -218,9 +218,20 @@ int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) { void CIrrDeviceSDL::resetReceiveTextInputEvents() { gui::IGUIElement *elem = GUIEnvironment->getFocus(); if (elem && elem->acceptsIME()) + { SDL_StartTextInput(); + core::rect pos = elem->getAbsolutePosition(); + SDL_Rect rect; + rect.x = pos.UpperLeftCorner.X; + rect.y = pos.UpperLeftCorner.Y; + rect.w = pos.LowerRightCorner.X - rect.x; + rect.h = pos.LowerRightCorner.Y - rect.y; + SDL_SetTextInputRect(&rect); + } else + { SDL_StopTextInput(); + } } //! constructor