From 889890810e942425751f36b194598ca79882d033 Mon Sep 17 00:00:00 2001 From: y5nw <37980625+y5nw@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:59:56 +0100 Subject: [PATCH] Use SDL's API function to check for TextInputActive state --- source/Irrlicht/CIrrDeviceSDL.cpp | 3 +-- source/Irrlicht/CIrrDeviceSDL.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp index 72f1b8c3..f761a13d 100644 --- a/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/source/Irrlicht/CIrrDeviceSDL.cpp @@ -224,7 +224,7 @@ void CIrrDeviceSDL::resetReceiveTextInputEvents() { // 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 (!lastElemPos || *lastElemPos != pos) + if (!SDL_IsTextInputActive() || lastElemPos != pos) { lastElemPos = pos; SDL_Rect rect; @@ -238,7 +238,6 @@ void CIrrDeviceSDL::resetReceiveTextInputEvents() { } else { - lastElemPos.reset(); SDL_StopTextInput(); } } diff --git a/source/Irrlicht/CIrrDeviceSDL.h b/source/Irrlicht/CIrrDeviceSDL.h index 014042ba..ebd8e032 100644 --- a/source/Irrlicht/CIrrDeviceSDL.h +++ b/source/Irrlicht/CIrrDeviceSDL.h @@ -24,7 +24,6 @@ #include #include -#include namespace irr { @@ -304,7 +303,7 @@ namespace irr bool Resizable; - std::optional> lastElemPos; + core::rect lastElemPos; struct SKeyMap {