Skip to content

Commit 3b2e248

Browse files
committed
Merge branch 'issue_9067_fix_dbus_stoptextinput_spam' into 'master'
Issue 9067 fix dbus stoptextinput spam Closes #9067 See merge request OpenMW/openmw!5298
2 parents a6c053a + 5afaf17 commit 3b2e248

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

apps/openmw/mwgui/windowmanagerimp.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,10 +1872,26 @@ namespace MWGui
18721872

18731873
void WindowManager::onKeyFocusChanged(MyGUI::Widget* widget)
18741874
{
1875-
bool isEditBox = widget && widget->castType<MyGUI::EditBox>(false);
1876-
LuaUi::WidgetExtension* luaWidget = dynamic_cast<LuaUi::WidgetExtension*>(widget);
1877-
bool capturesInput = luaWidget ? luaWidget->isTextInput() : isEditBox;
1878-
if (widget && capturesInput)
1875+
bool capturesInput = false;
1876+
if (widget)
1877+
{
1878+
LuaUi::WidgetExtension* luaWidget = dynamic_cast<LuaUi::WidgetExtension*>(widget);
1879+
if (luaWidget)
1880+
capturesInput = luaWidget->isTextInput();
1881+
else
1882+
capturesInput = widget->castType<MyGUI::EditBox>(false);
1883+
}
1884+
1885+
// The SDL_IsTextInputActive() check helps to avoid duplicate calls in SDL2.
1886+
// This may no longer be required when switching to SDL3 where the function
1887+
// has also been renamed to SDL_TextInputActive() and returns bool instead
1888+
// of SDL_bool.
1889+
1890+
const bool inputActive = SDL_IsTextInputActive() == SDL_TRUE;
1891+
if (capturesInput == inputActive)
1892+
return;
1893+
1894+
if (capturesInput)
18791895
SDL_StartTextInput();
18801896
else
18811897
SDL_StopTextInput();

0 commit comments

Comments
 (0)