diff options
| author | 2026-03-22 13:00:04 -0700 | |
|---|---|---|
| committer | 2026-03-22 16:00:04 -0400 | |
| commit | 4da9f41ffb998a753ecebcef577d00901a62af48 (patch) | |
| tree | a3198f9032d0f2f25bf7c75f8b85c52477d286d2 /src/osd/sdl3 | |
| parent | 3db360233335bbba24b8a753c02457fb0b0416b2 (diff) | |
osd/sdl: process events after raising window on macOS to ensure input focus (#15132)
On macOS, the window may not have acquired input focus by the time
SDL_RaiseWindow returns. Pumping events after raising ensures the
FOCUS_GAINED event is dequeued and m_focus_window is set before the
input modules start polling, preventing the intermittent loss of
keyboard and mouse input on startup.
Fixes mamedev/mame#10612
Diffstat (limited to 'src/osd/sdl3')
| -rw-r--r-- | src/osd/sdl3/video.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/osd/sdl3/video.cpp b/src/osd/sdl3/video.cpp index 395fc931a9b..3467fc153a6 100644 --- a/src/osd/sdl3/video.cpp +++ b/src/osd/sdl3/video.cpp @@ -73,7 +73,17 @@ bool sdl_osd_interface::video_init() } if (m_render->is_interactive()) - SDL_RaiseWindow(dynamic_cast<sdl_window_info &>(*osd_common_t::s_window_list.front()).platform_window()); + { + SDL_Window *const sdlwindow = dynamic_cast<sdl_window_info &>(*osd_common_t::s_window_list.front()).platform_window(); + SDL_RaiseWindow(sdlwindow); + +#ifdef SDLMAME_MACOSX + // ensure focus is acquired before the input modules start polling + process_events(); + if (!has_focus()) + osd_printf_verbose("Window did not acquire input focus\n"); +#endif + } return true; } |
