From 5948ea997ff32c800e66c0ba722d8e2712404e68 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 8 Jan 2024 13:54:18 -0800 Subject: [PATCH] Make sure new windows have mouse and keyboard focus if there's no windowing system --- src/video/SDL_video.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 8efd6f0dd7..3813b30dd6 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2131,9 +2131,15 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props) parent->first_child = window; } - if (_this->CreateSDLWindow && _this->CreateSDLWindow(_this, window, props) < 0) { - SDL_DestroyWindow(window); - return NULL; + if (_this->CreateSDLWindow) { + if (_this->CreateSDLWindow(_this, window, props) < 0) { + SDL_DestroyWindow(window); + return NULL; + } + } else { + /* No windowing system, make sure the new window has focus */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); } /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,