equal
deleted
inserted
replaced
32 #include "../SDL_sysjoystick.h" |
32 #include "../SDL_sysjoystick.h" |
33 #include "../SDL_joystick_c.h" |
33 #include "../SDL_joystick_c.h" |
34 #include "SDL_sysjoystick_c.h" |
34 #include "SDL_sysjoystick_c.h" |
35 #include "SDL_events.h" |
35 #include "SDL_events.h" |
36 #include "../../haptic/darwin/SDL_syshaptic_c.h" /* For haptic hot plugging */ |
36 #include "../../haptic/darwin/SDL_syshaptic_c.h" /* For haptic hot plugging */ |
37 #if !SDL_EVENTS_DISABLED |
|
38 #include "../../events/SDL_events_c.h" |
|
39 #endif |
|
40 |
37 |
41 #define SDL_JOYSTICK_RUNLOOP_MODE CFSTR("SDLJoystick") |
38 #define SDL_JOYSTICK_RUNLOOP_MODE CFSTR("SDLJoystick") |
42 |
39 |
43 /* The base object of the HID Manager API */ |
40 /* The base object of the HID Manager API */ |
44 static IOHIDManagerRef hidman = NULL; |
41 static IOHIDManagerRef hidman = NULL; |
152 device->deviceRef = NULL; // deviceRef was invalidated due to the remove |
149 device->deviceRef = NULL; // deviceRef was invalidated due to the remove |
153 #if SDL_HAPTIC_IOKIT |
150 #if SDL_HAPTIC_IOKIT |
154 MacHaptic_MaybeRemoveDevice(device->ffservice); |
151 MacHaptic_MaybeRemoveDevice(device->ffservice); |
155 #endif |
152 #endif |
156 |
153 |
157 /* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceRemoved()? */ |
154 SDL_PrivateJoystickRemoved(device->instance_id); |
158 #if !SDL_EVENTS_DISABLED |
|
159 { |
|
160 SDL_Event event; |
|
161 event.type = SDL_JOYDEVICEREMOVED; |
|
162 |
|
163 if (SDL_GetEventState(event.type) == SDL_ENABLE) { |
|
164 event.jdevice.which = device->instance_id; |
|
165 if ((SDL_EventOK == NULL) |
|
166 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
|
167 SDL_PushEvent(&event); |
|
168 } |
|
169 } |
|
170 } |
|
171 #endif /* !SDL_EVENTS_DISABLED */ |
|
172 } |
155 } |
173 |
156 |
174 |
157 |
175 static void AddHIDElement(const void *value, void *parameter); |
158 static void AddHIDElement(const void *value, void *parameter); |
176 |
159 |
474 } |
457 } |
475 curdevice->pNext = device; |
458 curdevice->pNext = device; |
476 ++device_index; /* bump by one since we counted by pNext. */ |
459 ++device_index; /* bump by one since we counted by pNext. */ |
477 } |
460 } |
478 |
461 |
479 /* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */ |
462 SDL_PrivateJoystickAdded(device_index); |
480 #if !SDL_EVENTS_DISABLED |
|
481 { |
|
482 SDL_Event event; |
|
483 event.type = SDL_JOYDEVICEADDED; |
|
484 |
|
485 if (SDL_GetEventState(event.type) == SDL_ENABLE) { |
|
486 event.jdevice.which = device_index; |
|
487 if ((SDL_EventOK == NULL) |
|
488 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
|
489 SDL_PushEvent(&event); |
|
490 } |
|
491 } |
|
492 } |
|
493 #endif /* !SDL_EVENTS_DISABLED */ |
|
494 } |
463 } |
495 |
464 |
496 static SDL_bool |
465 static SDL_bool |
497 ConfigHIDManager(CFArrayRef matchingArray) |
466 ConfigHIDManager(CFArrayRef matchingArray) |
498 { |
467 { |