Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 13 Jun 2014 14:52:26 -0400
changeset 8859 8396cc409327
parent 8858 a13c7a84c57f
child 8860 c4133d635375
Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling(). This fixes hotplugging failing to detect devices.
src/joystick/darwin/SDL_sysjoystick.c
--- a/src/joystick/darwin/SDL_sysjoystick.c	Fri Jun 13 10:50:24 2014 -0700
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Fri Jun 13 14:52:26 2014 -0400
@@ -604,7 +604,9 @@
 SDL_bool
 SDL_SYS_JoystickNeedsPolling()
 {
-	// BUGBUG - only works if someone else is pumping the CFRunLoop...
+    while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
+        /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
+    }
     return s_bDeviceAdded || s_bDeviceRemoved;
 }