Commit graph

7186 commits

Author SHA1 Message Date
Sam Lantinga eae81ec80e Touchpads already have their right/left buttons swapped in raw input
Fixes https://github.com/libsdl-org/SDL/issues/8597

(cherry picked from commit cf5e0637b5454b776f749beea856f1f595e03036)
2024-01-15 19:46:31 -08:00
Sam Lantinga f641d91f67 Restore window minimum and maximum size if it is recreated
Fixes https://github.com/libsdl-org/SDL/issues/8805

(cherry picked from commit fb2d7ed83efbeebeb537ea8c17694585c05ce8e3)
2024-01-15 16:35:03 -08:00
Susko3 38d11e5cc6 Add missing (void) in functions params 2024-01-13 11:45:44 -08:00
Susko3 bbe4d693eb Use correct touch check flag
Matches the one in `GetMouseMessageSource()`.
From my testing on Windows 11, the lower 8 bits in touch events cycle
trough the values 0x8c-0x95 in order.

(cherry picked from commit d747daf03d3210a794d609b8cc662f28beaedaf6)
2024-01-13 11:44:43 -08:00
Sam Lantinga b6e97d9ff0 Fixed Xcode warnings 2024-01-13 08:15:41 -08:00
Sylvain 347b6cdcb6
Prevent ASAN warning:
like SDL_triangle.c:305:30: runtime error: left shift of negative value -672
(even if the value was correctly computed)

(cherry picked from commit 4033a0a83b3a675c6b7803e36fb13114579d0b5b)
2024-01-13 13:58:30 +01:00
Alberto Mardegan 66209135df render: Fix line clipping with translated viewports
The previous code was working incorrectly on viewports not having the
top left corner on the origin: even in those cases we only need to look
at the width and height of the viewport, because the drawing coordinates
are translated.

Fixes #8828
2024-01-11 14:36:55 -08:00
Frank Praznik 9fe09950f1 wayland: Raise the frame throttle limit
Raise the minimum frame throttle limit to 1/3 the refresh rate (or 20hz) to prevent titles from timing out when occluded.
2024-01-10 17:06:47 -05:00
Caleb Cornett 71cd1fa595 Fix compile error with XInputOnGameInput.h
(cherry picked from commit d766f68cb30b058277b8d574c9d5a230265cbe73)
2024-01-10 12:54:00 -08:00
Simon McVittie 1634a4cc30 test: Use SDL_CreateRGBSurfaceWithFormatFrom for SDLTest_ImageFace
Unlike the test images in the previous commit, this one is
4-bytes-per-pixel RGBA32, so the masks used here appear to be correct
for both endiannesses. Converting it to SDL_PIXELFORMAT_RGBA32 just
makes it more concise.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:09:40 -08:00
Simon McVittie feaf52dba6 test: Fix encoding declaration for RGB24 test images
All of these test images are provided as an octal dump of
3-bytes-per-pixel data with red, green and blue bytes in that order,
referred to as RGB24 in SDL's taxonomy. However, the call to
SDL_CreateRGBSurfaceFrom() used masks that would have been appropriate
for RGBA32 data.

On little-endian platforms, the test images loaded as intended anyway,
because SDL does not actually check all four masks before deciding to
use RGB24 (it only looks at the red mask), and the red channel happens to
be in the 0x000000FF position for both RGB24 and RGBA32 on little-endian.

Unfortunately, on big-endian platforms, the required masks are not the
same and the call failed with "Unknown pixel format". As far as I can
tell, this means testautomation_surface has never succeeded on big-endian
platforms, but presumably nobody has tried to run it on such platforms
until now.

In the SDL 3 branch, this was fixed as a side-effect of commit
932f6134 "Remove mask versions of SDL_CreateRGBSurface* #6701  (#6711)",
which I have used as a reference to confirm that RGB24 is correct.

Resolves: https://github.com/libsdl-org/SDL/issues/8817
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:09:40 -08:00
Sam Lantinga 970ed36de5 Only force X11 if SDL_VIDEO_DRIVER_X11 is available 2024-01-09 11:56:26 -08:00
Sam Lantinga bd2f1e9ea6 Use the X11 driver if the application uses X11-based graphics frameworks
Fixes https://github.com/libsdl-org/SDL/issues/8812
2024-01-09 11:24:10 -08:00
Simon McVittie 64754f3a2a test: When listing test-cases, say which ones are disabled
When a test has been disabled because it's known not to work reliably
or it's a test for unimplemented functionality, we probably don't want
to encourage developers and testers to run it and report its failures
as a bug.

Helps: #8798, #8800
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-08 09:50:11 -08:00
Sam Lantinga 5e12e4b813 Updated documentation for SDL_HINT_SHUTDOWN_DBUS_ON_QUIT
(cherry picked from commit 3deefa6b438922d5d55cb881482f8550f51978b7)
2024-01-07 14:24:56 -08:00
Semphris 8c4e4d57b3 Add hint to make SDL handle dbus_shutdown()
(cherry picked from commit 2348e8b6a2598af2790937a62ee49cdb02d6bd28)
2024-01-07 14:23:57 -08:00
Sam Lantinga ca3b8fe91d Fixed build 2024-01-06 08:33:30 -08:00
Sam Lantinga e1c3dcb403 Don't try to send the PS third-party feature request to the Logitech G815 keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8373

(cherry picked from commit d3daba791aafa9a10db5b948fc33e62f75dff7e4)
2024-01-06 08:30:20 -08:00
Sam Lantinga c309546e8c Fixed warning: no previous prototype for function 'SDL_GetGameControllerTypeFromString' [-Wmissing-prototypes] 2024-01-06 08:23:55 -08:00
Sam Lantinga 0e913a22db Renamed ShowTextInput/HideTextInput to ShowScreenKeyboard/HideScreenKeyboard on Android
This better reflects the actual implementation and makes SDL_HINT_ENABLE_SCREEN_KEYBOARD work on Android.

Fixes https://github.com/libsdl-org/SDL/issues/8652

(cherry picked from commit 014a63b4b5b94ce50f329eddb345f5434654305b)
2024-01-06 08:23:11 -08:00
Sam Lantinga be29ca0189 Use the application requested size to determine automatic orientation on iOS
Fixes https://github.com/libsdl-org/SDL/issues/8201

(cherry picked from commit e3b5999bb4fe9bc8413630215d928f90347073d1)
2024-01-06 07:39:25 -08:00
Sam Lantinga f892ae10d6 updateKeyboard should use the SDL window's screen instead of the view window's screen, which may be nil.
Fixes https://github.com/libsdl-org/SDL/issues/8200

(cherry picked from commit 3a9a52fe6c40aee8d174bb756b4a339d35386633)
2024-01-06 07:37:14 -08:00
Sam Lantinga 674e894574 Added mapping for the RX Gamepad, e.g. Pandora Box 7
Fixes https://github.com/libsdl-org/SDL/issues/8217

(cherry picked from commit e100992c17ac58c243aa5b57151189963f6d1d4b)
2024-01-06 06:19:30 -08:00
jfmu eb1b9b418c SDL_audio.c: Fix crash if we switch from direct output to streaming, and if the buffersizes change. 2024-01-04 19:41:38 -05:00
Ozkan Sezer 7b4f1ef01b yuv2rgb: warning fixes and comment out unused code
(cherry picked from commit 46de6241d79c6f4531dbb729b2ed5992ec61b4a2)
(cherry picked from commit 0bd77a5b93494ca88bfd1a86fe106e7bb1d90133)
(cherry picked from commit f341c06552c8618c1178287880fcb8775decfbd3)
(cherry picked from commit 4d2f9f3a324884add7245e8cd13ee06af907c306)
(cherry picked from commit 06f8f9a891194d86ff93a5856f80510d39b75272)
(cherry picked from commit 0c4cb3d1539fefa66c05d131385e35fb2a205fa3)
(cherry picked from commit 0dad56354ceb4222be569e6969475adeec5a1ca1)
2024-01-03 09:07:50 -05:00
Vicki Pfau 41bf6b5a51 Add basic rumble support to Steam Deck
(cherry picked from commit bec1b8f849b782ca7d815337380c5f2b42ed60ce)
2024-01-01 21:48:41 -08:00
Sam Lantinga 0fc3574464 Updated copyright for 2024 2024-01-01 13:19:49 -08:00
Reilly Brogan 8030e7546a Fix static build with libdecor 0.2.0
(cherry picked from commit 4ce935b9106a0311436e41c5f28f00db30a93de1)
2023-12-26 16:30:32 -08:00
Reilly Brogan 5dfb0c19c8 Fix static build with libdrm 2.4.116 2023-12-26 16:29:01 -08:00
Alynne 2afbb5713c Add Access Controller
(cherry picked from commit cae657140c9436a18dac94356efeb7b2a60208a0)
2023-12-26 09:58:47 -08:00
Tyson Whitehead 3b1e0e163b Try SDL_UDEV_deviceclass to detect joysticks even if in a container
The udev container issue is mostly to do with device notifications
and netlink. The device classification stuff just pokes file in /sys
and /run/udev. Doesn't hurt to try it first for classifying joysticks
and then fall to the guess heuristics if it fails.
2023-12-24 16:02:38 -08:00
Sam Lantinga 857e5b08c3 Fixed trying to add a game controller mapping for the accelerometer on iOS
Fixes https://github.com/libsdl-org/SDL/issues/8716

(cherry picked from commit 0e5ea3cc4b98d061688a098836254ab6470b07e8)
2023-12-24 11:22:22 -08:00
Sam Lantinga aeda6a8e6f Record the initial input report mode and only restore simple mode if that's what we started with
Fixes https://github.com/libsdl-org/SDL/issues/8108
Closes https://github.com/libsdl-org/SDL/pull/8115

(cherry picked from commit c3d84c3342f61b808462c7437784af5df4906273)
2023-12-24 08:23:36 -08:00
Julian Uy 884c21c565 Use common generic syscond for platforms with no cond implementation 2023-12-24 06:35:59 -08:00
Julian Uy 557d8e2f24 PS2 use WaitSemaEx for waiting for semaphore with timeout 2023-12-24 06:34:45 -08:00
Sylvain 3a8032f491 Make sure the string is terminated, fixed invalid read in SDL_PrivateGameControllerParseControllerConfigString()
(cherry picked from commit 312f98c2a1edaf9590fc06d10f201996c059d869)
2023-12-23 12:58:54 -08:00
Lukas Senionis e7c4575719 Use crc16 return value when calculating GUID
Fixes the regression introduced by 919cd56b20

(cherry picked from commit a2e05480d63cac530269c846422e7de3b44e830f)
2023-12-21 07:00:57 -08:00
Sam Lantinga 919cd56b20 Use the original manufacturer and product strings for the joystick CRC
This allows the most information possible for the CRC string, which is used to differentiate controllers with the same VID/PID.

Fixes https://github.com/libsdl-org/SDL/issues/8724

(cherry picked from commit 1f1ee6f77c492e17a9691c367110c11529fab3fb)
2023-12-20 19:25:35 -08:00
Ozkan Sezer d76097dc5e fix os/2 and watcom builds after commit 7bb0e839a6 2023-12-21 01:11:24 +03:00
Sam Lantinga 7bb0e839a6 Added Steam Input API support for game controllers
Added support for getting the real controller info, as well as the function SDL_GameControllerGetSteamHandle() to get the Steam Input API handle, from the virtual gamepads provided by Steam.

Also added an event SDL_CONTROLLERSTEAMHANDLEUPDATED which is triggered when a controller's API handle changes, e.g. the controllers were reassigned slots in the Steam UI.

(cherry picked from commit c981a597dc7c69e7532796b3a206071807479d35)
2023-12-20 13:29:57 -08:00
Vicki Pfau 5240071b1c Sync more Steam Controller header definitions for the Steam Deck
(cherry picked from commit a8f4f40d08a28ca0ef4f518509639f2553d8a123)
2023-12-20 06:50:54 -08:00
Sam Lantinga 91f8b4dea2 Added a controller name for the Steam virtual gamepad
(cherry picked from commit 4d5949dcf64f2633b1b435fb0c22a3b0b44d855f)
2023-12-17 10:08:17 -08:00
Sam Lantinga 2aadef022e Pass through the name of the controller for the XInput mapping
(cherry picked from commit e6d88b254add377743de7bf33a7a4fec8cec79c3)
2023-12-17 09:32:54 -08:00
Dimitriy Ryazantcev 7391cd34da XInput: Use XInputGetCapabilitiesEx instead of fragile GuessXInputDevice
XInputGetCapabilitiesEx (ordinal 108) is available in XInput 1.4 that is shipped with Windows 8 and newer.

(cherry picked from commit 08a7ca4d53ef0d504ec780936fd65616fe3a9f09)
2023-12-17 09:32:43 -08:00
Susko3 cfecc569b5 Differentiate between Windows Ink (pen) and regular touch input
SDL2 backport of https://github.com/libsdl-org/SDL/pull/5926
2023-12-16 21:41:22 -08:00
Frank Praznik 867d8643d7 wayland: Handle mouse focus when receiving touch events
Compositors may switch from mouse to touch mode when a touch event is received, causing a pointer leave event and subsequent loss of mouse focus.

Don't relinquish mouse focus on surfaces with active touch events. If there are active touch events when pointer focus is lost, the keyboard focus is used as a fallback for relinquishing mouse focus: if, in this case, the keyboard focus is then lost and there are no active touches, mouse focus is lost, and if all touches are raised and there is no keyboard or pointer focus, then the window loses mouse focus.

(cherry picked from commit 21879faf4815a6acdb29e290d51a15bbe4dae03e)
2023-12-14 14:33:18 -05:00
Sam Lantinga 239b5278bf Revert "Back out Steam virtual gamepad changes"
This reverts commit f0e7f3e7e5.
2023-12-13 09:46:10 -08:00
Max Maisel 33588662ef Refactor away some additional integer types. 2023-12-12 12:52:04 -08:00
Max Maisel bed789794d Add new steam deck HIDAPI controller to controller database. 2023-12-12 12:52:04 -08:00
Max Maisel 0dbe9022fc Disable lizard mode while steam deck HID device is opened. 2023-12-12 12:52:04 -08:00