src/joystick/iphoneos/SDL_sysjoystick.m
changeset 10226 cb13d22b7f09
parent 9998 f67cf37e9cd4
child 10228 9a277db2806d
     1.1 --- a/src/joystick/iphoneos/SDL_sysjoystick.m	Fri Aug 26 11:16:44 2016 -0700
     1.2 +++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Fri Aug 26 12:18:08 2016 -0700
     1.3 @@ -32,10 +32,6 @@
     1.4  #include "../SDL_sysjoystick.h"
     1.5  #include "../SDL_joystick_c.h"
     1.6  
     1.7 -#if !SDL_EVENTS_DISABLED
     1.8 -#include "../../events/SDL_events_c.h"
     1.9 -#endif
    1.10 -
    1.11  #import <CoreMotion/CoreMotion.h>
    1.12  
    1.13  #ifdef SDL_JOYSTICK_MFI
    1.14 @@ -127,9 +123,6 @@
    1.15  SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer)
    1.16  {
    1.17      SDL_JoystickDeviceItem *device = deviceList;
    1.18 -#if !SDL_EVENTS_DISABLED
    1.19 -    SDL_Event event;
    1.20 -#endif
    1.21  
    1.22      while (device != NULL) {
    1.23          if (device->controller == controller) {
    1.24 @@ -172,17 +165,7 @@
    1.25  
    1.26      ++numjoysticks;
    1.27  
    1.28 -#if !SDL_EVENTS_DISABLED
    1.29 -    event.type = SDL_JOYDEVICEADDED;
    1.30 -
    1.31 -    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
    1.32 -        event.jdevice.which = numjoysticks - 1;
    1.33 -        if ((SDL_EventOK == NULL) ||
    1.34 -            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
    1.35 -            SDL_PushEvent(&event);
    1.36 -        }
    1.37 -    }
    1.38 -#endif /* !SDL_EVENTS_DISABLED */
    1.39 +    SDL_PrivateJoystickAdded(numjoysticks - 1);
    1.40  }
    1.41  
    1.42  static SDL_JoystickDeviceItem *
    1.43 @@ -191,9 +174,6 @@
    1.44      SDL_JoystickDeviceItem *prev = NULL;
    1.45      SDL_JoystickDeviceItem *next = NULL;
    1.46      SDL_JoystickDeviceItem *item = deviceList;
    1.47 -#if !SDL_EVENTS_DISABLED
    1.48 -    SDL_Event event;
    1.49 -#endif
    1.50  
    1.51      if (device == NULL) {
    1.52          return NULL;
    1.53 @@ -234,17 +214,7 @@
    1.54  
    1.55      --numjoysticks;
    1.56  
    1.57 -#if !SDL_EVENTS_DISABLED
    1.58 -    event.type = SDL_JOYDEVICEREMOVED;
    1.59 -
    1.60 -    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
    1.61 -        event.jdevice.which = device->instance_id;
    1.62 -        if ((SDL_EventOK == NULL) ||
    1.63 -            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
    1.64 -            SDL_PushEvent(&event);
    1.65 -        }
    1.66 -    }
    1.67 -#endif /* !SDL_EVENTS_DISABLED */
    1.68 +	SDL_PrivateJoystickRemoved(device->instance_id);
    1.69  
    1.70      SDL_free(device->name);
    1.71      SDL_free(device);