Parcourir la source

Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling().

This fixes hotplugging failing to detect devices.
Ryan C. Gordon il y a 12 ans
Parent
commit
9e5504f89d
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      src/joystick/darwin/SDL_sysjoystick.c

+ 3 - 1
src/joystick/darwin/SDL_sysjoystick.c

@@ -604,7 +604,9 @@ SDL_SYS_JoystickDetect()
 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;
 }