Compare commits

...

8 Commits

7 changed files with 39 additions and 8 deletions

View File

@@ -54,11 +54,6 @@ typedef struct SDL_Point
/** /**
* The structure that defines a point (floating point) * The structure that defines a point (floating point)
* *
* \sa SDL_FRectEmpty
* \sa SDL_FRectEquals
* \sa SDL_HasIntersectionF
* \sa SDL_IntersectFRect
* \sa SDL_UnionFRect
* \sa SDL_EncloseFPoints * \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect * \sa SDL_PointInFRect
*/ */
@@ -76,6 +71,7 @@ typedef struct SDL_FPoint
* \sa SDL_RectEquals * \sa SDL_RectEquals
* \sa SDL_HasIntersection * \sa SDL_HasIntersection
* \sa SDL_IntersectRect * \sa SDL_IntersectRect
* \sa SDL_IntersectRectAndLine
* \sa SDL_UnionRect * \sa SDL_UnionRect
* \sa SDL_EnclosePoints * \sa SDL_EnclosePoints
*/ */
@@ -88,6 +84,16 @@ typedef struct SDL_Rect
/** /**
* A rectangle, with the origin at the upper left (floating point). * A rectangle, with the origin at the upper left (floating point).
*
* \sa SDL_FRectEmpty
* \sa SDL_FRectEquals
* \sa SDL_FRectEqualsEpsilon
* \sa SDL_HasIntersectionF
* \sa SDL_IntersectFRect
* \sa SDL_IntersectFRectAndLine
* \sa SDL_UnionFRect
* \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect
*/ */
typedef struct SDL_FRect typedef struct SDL_FRect
{ {

View File

@@ -410,7 +410,6 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
mouse->x = x; mouse->x = x;
mouse->y = y; mouse->y = y;
mouse->has_position = SDL_TRUE; mouse->has_position = SDL_TRUE;
return 0;
} else if (!xrel && !yrel) { /* Drop events that don't change state */ } else if (!xrel && !yrel) { /* Drop events that don't change state */
#ifdef DEBUG_MOUSE #ifdef DEBUG_MOUSE
SDL_Log("Mouse event didn't change state - dropped!\n"); SDL_Log("Mouse event didn't change state - dropped!\n");

View File

@@ -1497,6 +1497,7 @@ void HID_API_EXPORT hid_close(hid_device *dev)
/* Clean up the Transfer objects allocated in read_thread(). */ /* Clean up the Transfer objects allocated in read_thread(). */
free(dev->transfer->buffer); free(dev->transfer->buffer);
dev->transfer->buffer = NULL;
libusb_free_transfer(dev->transfer); libusb_free_transfer(dev->transfer);
/* release the interface */ /* release the interface */

View File

@@ -961,7 +961,10 @@ HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev,
axis = ((int)packet->ucRightJoystickY * 257) - 32768; axis = ((int)packet->ucRightJoystickY * 257) - 32768;
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
if (packet->ucBatteryLevel & 0x10) { /* A check of packet->ucBatteryLevel & 0x10 should work as a check for BT vs USB but doesn't
* seem to always work. Possibly related to being 100% charged?
*/
if (!ctx->is_bluetooth) {
/* 0x20 set means fully charged */ /* 0x20 set means fully charged */
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED);
} else { } else {

View File

@@ -330,6 +330,19 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle
subtype = 1; subtype = 1;
} }
if (SDL_strcmp(name, "Backbone One") == 0) {
/* The Backbone app uses the guide and share buttons */
if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) != 0) {
device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_GUIDE);
--nbuttons;
}
if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1)) != 0) {
device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_MISC1);
--nbuttons;
device->has_xbox_share_button = SDL_FALSE;
}
}
device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->naxes = 6; /* 2 thumbsticks and 2 triggers */
device->nhats = 1; /* d-pad */ device->nhats = 1; /* d-pad */
device->nbuttons = nbuttons; device->nbuttons = nbuttons;

View File

@@ -1322,8 +1322,10 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
return SDL_SetError("Setting vibration failed: 0x%lx\n", hr); return SDL_SetError("Setting vibration failed: 0x%lx\n", hr);
} }
}
return 0; return 0;
} else {
return SDL_SetError("Controller isn't correlated yet, try hitting a button first");
}
#else #else
return SDL_Unsupported(); return SDL_Unsupported();
#endif #endif

View File

@@ -1230,6 +1230,13 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
} }
} }
#ifdef __MACOSX__
// On macOS on older systems, the OpenGL view change and resize events aren't
// necessarily synchronized, so just always reset it.
// Workaround for: https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6
data->drawstate.viewport_dirty = SDL_TRUE;
#endif
while (cmd) { while (cmd) {
switch (cmd->command) { switch (cmd->command) {
case SDL_RENDERCMD_SETDRAWCOLOR: { case SDL_RENDERCMD_SETDRAWCOLOR: {