mirror of https://github.com/minetest/irrlicht.git
[SDL] Set text input rectangle for IMEs
This commit is contained in:
parent
f1504093d1
commit
eca3f0b6be
|
@ -218,9 +218,20 @@ int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) {
|
||||||
void CIrrDeviceSDL::resetReceiveTextInputEvents() {
|
void CIrrDeviceSDL::resetReceiveTextInputEvents() {
|
||||||
gui::IGUIElement *elem = GUIEnvironment->getFocus();
|
gui::IGUIElement *elem = GUIEnvironment->getFocus();
|
||||||
if (elem && elem->acceptsIME())
|
if (elem && elem->acceptsIME())
|
||||||
|
{
|
||||||
SDL_StartTextInput();
|
SDL_StartTextInput();
|
||||||
|
core::rect<s32> 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
|
else
|
||||||
|
{
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
|
|
Loading…
Reference in New Issue