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 88598396cc409327
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
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Fri Jun 13 10:50:24 2014 -0700
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Fri Jun 13 14:52:26 2014 -0400
     1.3 @@ -604,7 +604,9 @@
     1.4  SDL_bool
     1.5  SDL_SYS_JoystickNeedsPolling()
     1.6  {
     1.7 -	// BUGBUG - only works if someone else is pumping the CFRunLoop...
     1.8 +    while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
     1.9 +        /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
    1.10 +    }
    1.11      return s_bDeviceAdded || s_bDeviceRemoved;
    1.12  }
    1.13