mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 21:09:34 -10:00
runloop_idle_wait had grown a platform ladder - Win32 message queue, X11 socket, Android looper - inside runloop.c, and Apple had no entry because runloop.c cannot know which of Apple's two loop models it is running under. The wait source is a property of the windowing system, so it becomes a method of the display server, which already has one driver per windowing system: idle_wait(data, ms) blocks until the event transport is readable or ms pass, dispatches nothing, and returns false when the server has no waitable source, in which case runloop sleeps as before. runloop.c keeps one call and no ifdefs. Win32 waits on the calling thread's message queue. X11 polls the connection fd, moved here from x11_common. Android polls the ident-based looper. SDL2 and SDL3 use SDL_WaitEventTimeout with a NULL event, which removes nothing. Apple: under HAVE_QT RetroArch owns the main loop and the wait runs the default CFRunLoop mode until a source is handled or the deadline; on every other build the OS drives runloop_iterate from an observer or a display link and the run loop between callbacks is the wait, so the method returns at once - except a backgrounded iOS or tvOS app, which keeps the sleep so a suspended loop cannot become a spin. The COCOATOUCH branch at the call site goes with it. Wayland stays NULL, and the driver says why: this server holds its own wl_display, input rides the video context's, and the real wait needs that display plus the prepare-read pairing verified against a live compositor. KMS has no window; UWP awaits a CoreDispatcher wait in a later round. Two latent header dependencies surfaced by the new lane are fixed: platform_unix.h sizes struct android_app by DEFAULT_MAX_PADS without including input_driver.h, and dispserv_android.c uses PROP_VALUE_MAX without sys/system_properties.h - both hidden until now by griffin's include order. dispserv_android.c now compiles in the matrix under -DANDROID against a JNI stub carrying the interface slots RetroArch calls; the lane was shown failing on a misspelled looper call before this commit. Verified: the 91-lane matrix; the linux build compiling the x11, wayland, kms and sdl2 servers with the declaration gate on every touched C file and the ELF audit steady; the mingw build compiling the win32 server and linking with the PE audit steady. The Apple driver has no toolchain here and is inspection-class, and says so.