sdl_gl_ctx: fix focus detection on webOS (#13526)

This commit is contained in:
Piotr Dobrowolski 2022-01-24 16:31:35 +01:00 committed by GitHub
parent 6ae1270e5c
commit a612e7f7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1144,7 +1144,7 @@ static const bool audio_enable_menu_bgm = false;
#define DEFAULT_REWIND_GRANULARITY 1 #define DEFAULT_REWIND_GRANULARITY 1
#endif #endif
/* Pause gameplay when gameplay loses focus. */ /* Pause gameplay when gameplay loses focus. */
#if defined(EMSCRIPTEN) || defined(WEBOS) #if defined(EMSCRIPTEN)
#define DEFAULT_PAUSE_NONACTIVE false #define DEFAULT_PAUSE_NONACTIVE false
#else #else
#define DEFAULT_PAUSE_NONACTIVE true #define DEFAULT_PAUSE_NONACTIVE true

View File

@ -377,7 +377,12 @@ static bool sdl_ctx_has_focus(void *data)
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
#ifdef WEBOS
// We do not receive mouse focus when non-magic remote is used.
flags = (SDL_WINDOW_INPUT_FOCUS);
#else
flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS); flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
#endif
return (SDL_GetWindowFlags(sdl->win) & flags) == flags; return (SDL_GetWindowFlags(sdl->win) & flags) == flags;
#else #else
flags = (SDL_APPINPUTFOCUS | SDL_APPACTIVE); flags = (SDL_APPINPUTFOCUS | SDL_APPACTIVE);