From 9e5504f89d8a42b9d2ed78e8a86734053840cb9b Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 13 Jun 2014 14:52:26 -0400 Subject: [PATCH] Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling(). This fixes hotplugging failing to detect devices. --- src/joystick/darwin/SDL_sysjoystick.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index 9ad8c44b8..bdb6d2939 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/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; }