From 977ab5e6836f97cbaea9961cec8ff8f0af48528b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 14 Jul 2021 19:19:45 +0200 Subject: [PATCH] (RPi) Fixed an issue where the window focus would sometimes get lost when returning from a game. --- es-core/src/Platform.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/es-core/src/Platform.cpp b/es-core/src/Platform.cpp index c90b4940f..5d2a9ed81 100644 --- a/es-core/src/Platform.cpp +++ b/es-core/src/Platform.cpp @@ -100,6 +100,14 @@ int launchGameUnix(const std::string& cmd_utf8, bool runInBackground) } returnValue = pclose(commandPipe); + +#if defined(_RPI_) + // Hack to avoid that the application window occasionally loses focus when returning from + // a game, which only seems to happen on the Raspberry Pi. + SDL_Delay(50); + SDL_SetWindowInputFocus(Renderer::getSDLWindow()); +#endif + // We need to shift the return value as it contains some flags (which we don't need). returnValue >>= 8;