src/joystick/android/SDL_sysjoystick.c
changeset 10226 cb13d22b7f09
parent 10223 74c39dbe8d30
child 10499 363c1c7e7a41
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Fri Aug 26 11:16:44 2016 -0700
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Fri Aug 26 12:18:08 2016 -0700
     1.3 @@ -27,10 +27,6 @@
     1.4  #include "SDL_error.h"
     1.5  #include "SDL_events.h"
     1.6  
     1.7 -#if !SDL_EVENTS_DISABLED
     1.8 -#include "../../events/SDL_events_c.h"
     1.9 -#endif
    1.10 -
    1.11  #include "SDL_joystick.h"
    1.12  #include "SDL_hints.h"
    1.13  #include "SDL_assert.h"
    1.14 @@ -252,9 +248,6 @@
    1.15  {
    1.16      SDL_JoystickGUID guid;
    1.17      SDL_joylist_item *item;
    1.18 -#if !SDL_EVENTS_DISABLED
    1.19 -    SDL_Event event;
    1.20 -#endif
    1.21      
    1.22      if(JoystickByDeviceId(device_id) != NULL || name == NULL) {
    1.23          return -1;
    1.24 @@ -299,17 +292,7 @@
    1.25      /* Need to increment the joystick count before we post the event */
    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  #ifdef DEBUG_JOYSTICK
    1.42      SDL_Log("Added joystick %s with device_id %d", name, device_id);
    1.43 @@ -323,9 +306,6 @@
    1.44  {
    1.45      SDL_joylist_item *item = SDL_joylist;
    1.46      SDL_joylist_item *prev = NULL;
    1.47 -#if !SDL_EVENTS_DISABLED
    1.48 -    SDL_Event event;
    1.49 -#endif
    1.50      
    1.51      /* Don't call JoystickByDeviceId here or there'll be an infinite loop! */
    1.52      while (item != NULL) {
    1.53 @@ -357,17 +337,7 @@
    1.54      /* Need to decrement the joystick count before we post the event */
    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 = item->device_instance;
    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(item->device_instance);
    1.69  
    1.70  #ifdef DEBUG_JOYSTICK
    1.71      SDL_Log("Removed joystick with device_id %d", device_id);