|
@@ -1753,6 +1753,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S
|
|
|
|
|
|
/* Update internal joystick state */
|
|
|
info->value = value;
|
|
|
+ joystick->update_complete = timestamp;
|
|
|
|
|
|
/* Post the event, if desired */
|
|
|
posted = 0;
|
|
@@ -1795,6 +1796,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
|
|
|
|
|
|
/* Update internal joystick state */
|
|
|
joystick->hats[hat] = value;
|
|
|
+ joystick->update_complete = timestamp;
|
|
|
|
|
|
/* Post the event, if desired */
|
|
|
posted = 0;
|
|
@@ -1853,6 +1855,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
|
|
|
|
|
|
/* Update internal joystick state */
|
|
|
joystick->buttons[button] = state;
|
|
|
+ joystick->update_complete = timestamp;
|
|
|
|
|
|
/* Post the event, if desired */
|
|
|
posted = 0;
|
|
@@ -1913,6 +1916,21 @@ void SDL_UpdateJoysticks(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_UPDATE_COMPLETE)) {
|
|
|
+ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
|
|
|
+ if (joystick->update_complete) {
|
|
|
+ SDL_Event event;
|
|
|
+
|
|
|
+ event.type = SDL_EVENT_JOYSTICK_UPDATE_COMPLETE;
|
|
|
+ event.common.timestamp = joystick->update_complete;
|
|
|
+ event.gdevice.which = joystick->instance_id;
|
|
|
+ SDL_PushEvent(&event);
|
|
|
+
|
|
|
+ joystick->update_complete = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/* this needs to happen AFTER walking the joystick list above, so that any
|
|
|
dangling hardware data from removed devices can be free'd
|
|
|
*/
|
|
@@ -3178,6 +3196,7 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch
|
|
|
finger_info->x = x;
|
|
|
finger_info->y = y;
|
|
|
finger_info->pressure = pressure;
|
|
|
+ joystick->update_complete = timestamp;
|
|
|
|
|
|
/* Post the event, if desired */
|
|
|
posted = 0;
|
|
@@ -3219,6 +3238,7 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT
|
|
|
|
|
|
/* Update internal sensor state */
|
|
|
SDL_memcpy(sensor->data, data, num_values * sizeof(*data));
|
|
|
+ joystick->update_complete = timestamp;
|
|
|
|
|
|
/* Post the event, if desired */
|
|
|
#ifndef SDL_EVENTS_DISABLED
|