Mac: Detect the d-pad and pause buttons on Steelseries MFi gamepads (bug #3124.)
authorAlex Szpakowski
Thu, 12 Nov 2015 22:44:32 -0400
changeset 9912628225876708
parent 9911 7423403b70da
child 9913 3a1a20edbecc
Mac: Detect the d-pad and pause buttons on Steelseries MFi gamepads (bug #3124.)
src/joystick/darwin/SDL_sysjoystick.c
src/video/uikit/SDL_uikitwindow.m
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Thu Nov 12 20:58:11 2015 -0400
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Thu Nov 12 22:44:32 2015 -0400
     1.3 @@ -243,6 +243,18 @@
     1.4                                      }
     1.5                                  }
     1.6                                  break;
     1.7 +                            case kHIDUsage_GD_DPadUp:
     1.8 +                            case kHIDUsage_GD_DPadDown:
     1.9 +                            case kHIDUsage_GD_DPadRight:
    1.10 +                            case kHIDUsage_GD_DPadLeft:
    1.11 +                                if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
    1.12 +                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
    1.13 +                                    if (element) {
    1.14 +                                        pDevice->buttons++;
    1.15 +                                        headElement = &(pDevice->firstButton);
    1.16 +                                    }
    1.17 +                                }
    1.18 +                                break;
    1.19                          }
    1.20                          break;
    1.21  
    1.22 @@ -265,6 +277,7 @@
    1.23                          break;
    1.24  
    1.25                      case kHIDPage_Button:
    1.26 +                    case kHIDPage_Consumer: /* e.g. 'pause' button on Steelseries MFi gamepads. */
    1.27                          if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
    1.28                              element = (recElement *) SDL_calloc(1, sizeof (recElement));
    1.29                              if (element) {
     2.1 --- a/src/video/uikit/SDL_uikitwindow.m	Thu Nov 12 20:58:11 2015 -0400
     2.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Thu Nov 12 22:44:32 2015 -0400
     2.3 @@ -317,6 +317,10 @@
     2.4                  [view setSDLWindow:NULL];
     2.5              }
     2.6  
     2.7 +            /* iOS may still hold a reference to the window after we release it.
     2.8 +             * We want to make sure the SDL view controller isn't accessed in
     2.9 +             * that case, because it would contain an invalid pointer to the old
    2.10 +             * SDL window. */
    2.11              data.uiwindow.rootViewController = nil;
    2.12              data.uiwindow.hidden = YES;
    2.13          }