mirror of
https://github.com/encounter/SDL.git
synced 2025-12-11 06:27:44 +00:00
Send Apple TV remote input as key events unless it's opened as a joystick, to match Android behavior.
This commit is contained in:
@@ -60,6 +60,7 @@ static SDL_JoystickDeviceItem *deviceList = NULL;
|
||||
|
||||
static int numjoysticks = 0;
|
||||
static SDL_JoystickID instancecounter = 0;
|
||||
int SDL_AppleTVRemoteOpenedAsJoystick = 0;
|
||||
|
||||
static SDL_JoystickDeviceItem *
|
||||
GetDeviceForIndex(int device_index)
|
||||
@@ -116,6 +117,7 @@ SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *contr
|
||||
#if TARGET_OS_TV
|
||||
else if (controller.microGamepad) {
|
||||
device->guid.data[10] = 3;
|
||||
device->remote = SDL_TRUE;
|
||||
}
|
||||
#endif /* TARGET_OS_TV */
|
||||
|
||||
@@ -455,6 +457,9 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
||||
#endif /* SDL_JOYSTICK_MFI */
|
||||
}
|
||||
}
|
||||
if (device->remote) {
|
||||
++SDL_AppleTVRemoteOpenedAsJoystick;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -719,6 +724,9 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (device->remote) {
|
||||
--SDL_AppleTVRemoteOpenedAsJoystick;
|
||||
}
|
||||
}
|
||||
|
||||
/* Function to perform any system-specific joystick related cleanup */
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
typedef struct joystick_hwdata
|
||||
{
|
||||
SDL_bool accelerometer;
|
||||
SDL_bool remote;
|
||||
|
||||
GCController __unsafe_unretained *controller;
|
||||
int num_pause_presses;
|
||||
|
||||
Reference in New Issue
Block a user