From 741af051592895d72ca9ac3beff4d3a3095a6fa9 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sat, 4 Apr 2026 18:36:51 +0300 Subject: [PATCH] Fix destroyed windows removing keyboard focus on macOS --- Source/Engine/Platform/SDL/SDLWindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Platform/SDL/SDLWindow.cpp b/Source/Engine/Platform/SDL/SDLWindow.cpp index 07983ae3c..bbc17ed3d 100644 --- a/Source/Engine/Platform/SDL/SDLWindow.cpp +++ b/Source/Engine/Platform/SDL/SDLWindow.cpp @@ -294,8 +294,13 @@ SDLWindow::~SDLWindow() if (Input::Mouse != nullptr && Input::Mouse->IsRelative(this)) Input::Mouse->SetRelativeMode(false, this); - - SDL_StopTextInput(_window); + + // The text input events seems to be controlled globally on macOS, + // calling this for closing window seems to remove keyboard focus from other windows... +#if !PLATFORM_MAC + if (_settings.AllowInput && SDL_TextInputActive(_window)) + SDL_StopTextInput(_window); +#endif SDL_DestroyWindow(_window); _window = nullptr;