Commit Graph

13564 Commits

Author SHA1 Message Date
bubbleguuum
f1f4d0d229 Fix opening pipewire device blocking indefinitely if no device
If wireplumber is not running or if there is no audio device,
PIPEWIRE_OpenDevice could remain stuck indefinityely on PIPEWIRE_pw_thread_loop_wait
because priv->stream_init_status is never equal to PW_READY_FLAG_ALL_PREOPEN_BITS.
Use PIPEWIRE_pw_thread_loop_timed_wait instead with a 2 seconds timeout and bail
out with an error on timeout.
A 2 seconds timeout seems plenty enough: in my observations, when there is an audio device,
the wait for the device to be ready is just a few milliseconds.
2026-06-25 09:41:15 -04:00
Sam Lantinga
089b862732 Added SDL_HINT_WINDOWS_RAW_MOUSE_NOLEGACY 2026-06-24 12:45:36 -07:00
Bartłomiej Dach
9acf54142e iOS: Fix crash on pinch gesture
Related: 65091012b4

After the aforementioned commit, pinching in any iOS app using SDL
crashes with

	*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UIPinchGestureRecognizer locationOfTouch:inView:]: index (1) beyond bounds (1).'
	*** First throw call stack:
	(0x19d31a23c 0x199de9224 0x19d37fec4 0x1a3f99bf0 0x1a3fa3c68 0x103277370 0x1a33b8b7c 0x1a33b848c 0x1a33b8238 0x1a2efc9a4 0x1a2ec1310 0x1a8ab8754 0x1a8af6c1c 0x1a8abc324 0x1a8ac79f4 0x1a2f010e8 0x1a2ee9550 0x1a2efd638 0x1a2eea040 0x1a2f0318c 0x1a2eecd48 0x1a2f062a8 0x1a2f03834 0x2b210f56c 0x19d2a5358 0x19d2a52cc 0x19d26a5a8 0x19d2341a0 0x19d23354c 0x1032bcdd8 0x1032ee2a0 0x1032ee3fc 0x1032ee360 0x102280644 0x10228042c 0x1033cd0cc 0x1032a8198 0x19a61f5dc 0x19d273960 0x19d273658 0x19d2731cc 0x19d234584 0x19d23354c 0x24299f498 0x1a2f2c244 0x1a2e97158 0x1032a5780 0x102280030 0x199e41c1c)
	libc++abi: terminating due to uncaught exception of type NSException

As it turns out, `UIPinchGestureRecognizer` does not guarantee the
presence of two touches throughout the entire duration of the pinch.
When the user is releasing the touches that constitute the pinch
gesture, more often than not they will release one touch before the
other. When this happens, `UIPinchGestureRecognizer` *does not terminate
the pinch*, but continues updating it, only with one touch remaining in
the gesture. The gesture is only marked concluded when the user releases
*both* touches.

To prevent the crash, check that the second touch is actually available
via the `numberOfTouches` property. If it is not, avoid emitting
`SDL_EVENT_PINCH_UPDATE` events to prevent sending unexpected payloads
downstream; there is no second touch to use anymore to calculate
`(focus|span)_(x|y)`.
2026-06-24 10:28:07 -07:00
Frank Praznik
a7ade74cf1 notification: Check the icon string before duplicating
Fixes #15877
2026-06-23 14:28:17 -04:00
Sam Lantinga
7be5990089 Removed redundant check for VK_SUCCESS
Fixes https://github.com/libsdl-org/SDL/issues/15157
2026-06-23 08:59:16 -07:00
Sam Lantinga
284afc2c9a Set SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER to the correct texture
Fixes https://github.com/libsdl-org/SDL/issues/15157
2026-06-23 08:57:49 -07:00
Frank Praznik
e26370810b gpu/vulkan renderer: Reconfigure the window on renderer creation if it has the OpenGL flag
In some cases, conflicts can occur at the platform or driver level if a window initially configured for OpenGL is then used with a Vulkan-based renderer. Try to reconfigure or recreate the window in the unlikely event that it has the OpenGL flag set when initializing the Vulkan or GPU renderer to remove any platform or driver-specific OpenGL objects and properties.
2026-06-23 11:03:05 -04:00
Sam Lantinga
a45ef5dc64 Added RIDEV_NOLEGACY to improve performance in mouse relative mode (thanks @whrvt!)
This change also makes it so relative mode doesn't kick in until the mouse enters the window client area. This prevents relative mode from kicking in while clicking and dragging on the title bar, etc.
2026-06-23 07:10:25 -07:00
Sam Lantinga
07ecc125cf Added SDL_PIXELFORMAT_P408 and SDL_PIXELFORMAT_P416 2026-06-22 17:01:54 -05:00
Brent Page
65091012b4 Add more information for pinch gestures on mobile (#15092) 2026-06-21 20:30:50 -07:00
Semphriss
e52dbf4442 Add basic Ubuntu Touch functions #12543
This adds support for:
* System theme
* Sandbox detection
* Device form factor detection

Many things aren't properly supported yet, but changes and upgrades will happen on the Ubuntu Touch side, so SDL should automatically support more Ubuntu Touch features as time goes.
2026-06-21 11:51:15 -07:00
Christian Semmler
a0b7ea0304 timer: drop unused mach_base_info on Apple
The Apple counter uses clock_gettime_nsec_np(CLOCK_UPTIME_RAW) and the
frequency is SDL_NS_PER_SECOND, so the mach timebase is no longer used.
2026-06-21 10:44:37 -05:00
Semphriss
d474769878 Detect device form factor (#12584) 2026-06-21 08:33:13 -07:00
Caleb Cornett
3561f81400 gpu: Metal fence fixes 2026-06-21 10:08:01 -05:00
Christian Semmler
e575093c83 Fix Apple performance frequency to match nanosecond counter
The counter returns ns via clock_gettime_nsec_np, so the frequency must be SDL_NS_PER_SECOND.
2026-06-20 23:01:33 -04:00
Gabriel Ford
49879ba0d6 free capacitive sensors on joystick close
Fixes: #15856
2026-06-19 20:05:28 -05:00
Ryan C. Gordon
3a1cfbc147 main: If SDL_MAIN_CALLBACK_RATE="waitevent", have at least one iteration run.
This way apps can at least draw an initial image to their windows before going
into a deep, blocking wait for user interaction.

Fixes #15027.
2026-06-19 14:14:13 -04:00
Ryan C. Gordon
e63b247738 io_uring: Annotate for ThreadSanitizer, since the ring is serializing access.
This doesn't _suppress_ the warnings, it annotates our memory access pattern
so ThreadSanitizer knows that threads aren't in conflict, since TSan doesn't
know about io_uring's mechanisms.

Fixes #15083.
2026-06-19 13:42:10 -04:00
Frank Praznik
b3f8367134 wayland: Make external window reconfiguration more robust
External window surfaces can't be destroyed and recreated, so try our best to reconfigure them when switching between GL profiles, or between GL and Vulkan.
2026-06-19 13:07:16 -04:00
Frank Praznik
4c28a67cd5 gles: Try to reconfigure the window instead of recreating it
SDL_ReconfigureWindow will fall back to recreation if necessary.
2026-06-19 10:25:39 -04:00
Ryan C. Gordon
d5dca1ec3d dos: Don't do parameter validation in SDL_SYS_GetPrefPath.
The higher level did it already.
2026-06-18 13:46:13 -04:00
Frank Praznik
06795b00ad wayland: Attach EGL objects to custom and external surfaces during reconfiguration
They are required when using EGL with an external surface.
2026-06-18 10:56:20 -04:00
Frank Praznik
dbfddb6409 wayland: External windows are never hidden
Needed for the GPU renderer to function properly.
2026-06-18 10:56:20 -04:00
Anonymous Maarten
9b230dfb36 cmake: add SDL_LIBUDEV_SHARED option 2026-06-18 03:47:07 -07:00
Christmas-Missionary
225001b53b replaced mach_absolute_time()
- Addresses issue #15115
- mach_absolute_time can be misused for fingerprinting. This is bad.
- Apple docs prefer clock_gettime_nsec_np(CLOCK_UPTIME_RAW) in time.h
- Since HAVE_NANOSLEEP is defined, time.h is included
2026-06-18 00:45:49 -04:00
Vicki Pfau
ca67f19c8f Fix discrete Joy-Con mappings on Linux 2026-06-17 20:49:28 -07:00
Sam Lantinga
c9b6581210 Added SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD 2026-06-17 16:48:54 -07:00
tmkk
cee2cb8ed1 hidapi: do not enumerate XInput devices owned by a kernel driver via libusb on macOS 2026-06-17 06:52:42 -07:00
Sam Lantinga
54e672ec0d Added a note about where to set global platform properties 2026-06-16 16:50:33 -07:00
Alex Tselousov
514b26e4c4 Removed busyloop from SDL_GPUFence on MacOS
Before, MetalFence was implemented as simply a busy loop on an atomic
int on metal, meaning the cpu would busy wait on the gpu to finish
taking power from it and decreasing battery life. This was the only kind
of cpu-gpu syncing (apart from requesting a swapchain)
2026-06-16 16:38:27 -07:00
Craig McLure
0c161c9e9c Add support for Virtual Pipewire Source Nodes 2026-06-16 14:18:41 -04:00
ItchyTrack
a3e47fb4dc Add "/usr/local/lib/libvulkan.dylib" as a path checked when loading Vulkan on MacOS 2026-06-16 11:13:43 -07:00
Sam Lantinga
ca66808c80 Reduce log message verbosity when shutting down KMSDRM
Fixes https://github.com/libsdl-org/SDL/issues/13569
2026-06-16 09:18:13 -07:00
Ryan C. Gordon
e936ac8748 video: Removed FIXME for something we cannot fix.
Reference Issue #11992.
2026-06-16 11:50:04 -04:00
Ozkan Sezer
6180b71d7c SDL_dbus.h: define DBUS_TYPE_UNIX_FD_AS_STRING if missing. 2026-06-16 12:00:24 +03:00
Pierre de La Morinerie
51e214a012 SDL_joystick: add Austgame adapter to gamecube devices
"Austgame GameCube to USB converter" is an GameCube-to-USB adapter.
2026-06-14 08:43:08 -07:00
Nintorch
7bbd9d5c2c Add normalized name for Emscripten joysticks 2026-06-13 07:20:33 -07:00
arnau.nau
46d0ecead0 hidapi: fix function pointer type mismatch in backend table
The HIDAPI backend table used function pointers that didn't match the
macro-renamed backend function types, which trips Clang's function sanitizer.

Adding small wrappers so the backend table has the correct function types and
the cast to the backend-specific device type happens inside a direct call.
fixes #15821.
2026-06-13 07:18:23 -07:00
Sam Lantinga
9c30a7cc82 Revert "Add an invalid #define for SDL_ThreadID() to SDL_oldnames.h (#15801)"
This reverts commit b04d026458.

This caused problems building sdl2-compat:
https://github.com/libsdl-org/sdl2-compat/actions/runs/27378527337/job/81120423041
2026-06-12 14:59:22 -07:00
Daniel Gibson
b04d026458 Add an invalid #define for SDL_ThreadID() to SDL_oldnames.h (#15801)
in SDL2 SDL_ThreadID() was a function that's now
SDL_GetCurrentThreadID(), but in SDL3 SDL_ThreadID is a type, so
in C++ `x = SDL_ThreadID()` is valid code (default constructor which
in case of integers means 0), so that's a massive footgun.

See the big comment in SDL_oldnames.h for more details.

Added `#undef SDL_ThreadID` in SDL_dynapi.c because it has one of the
(quite rare) cases  where "SDL_ThreadID" followed by a "(" is actually
correct and necessary (function pointer returning SDL_ThreadID).
2026-06-12 10:24:56 -07:00
Nintorch
4f031ea5da Fix Xbox One controller detection on the web 2026-06-12 09:02:58 -07:00
Nintorch
4a0d66116f Fix web crash for joystick without vibration 2026-06-12 08:53:07 -07:00
Nintorch
5e54decf53 Fix JoyCon pair type detection on the web 2026-06-12 07:44:34 -07:00
Nintorch
95dafa2bcd Don't modify the driver signature on the web 2026-06-12 07:43:07 -07:00
Frank Praznik
34af24276f EGL: Always pass the platform type when available
Always pass the EGL platform type for Wayland and X11, or the driver could potentially select the wrong backend if certain envvars are misconfigured.
2026-06-12 10:00:37 -04:00
Sam Lantinga
0d971b1372 Use GetTempPathW() instead of GetTempPath2W()
GetTempPath2() is only available on Windows 11 and Windows 10 systems with full updates. We want to be compatible back to earlier versions of Windows and the only difference between the two calls is the behavior for processes running as SYSTEM, which we don't expect for SDL applications using notifications.
2026-06-11 13:31:12 -07:00
Sam Lantinga
e0a935d910 Fixed warning: a function declaration without a prototype is deprecated in all versions of C 2026-06-10 14:33:49 -07:00
Sam Lantinga
df294acbae Fixed error C2440: 'function': cannot convert from 'int (__cdecl *)(libusb_context *,libusb_device *,libusb_hotplug_event,void *)' to 'libusb_hotplug_callback_fn' 2026-06-10 13:29:23 -07:00
Sam Lantinga
1475239328 Added hotplug detection when using libusb
Also switched to a single thread for libusb read operations instead of one thread per device
2026-06-10 13:07:47 -07:00
Sam Lantinga
18fc4d931a Added support for Xbox controllers via libusb on macOS
A number of third party Xbox controllers are not supported by macOS, but work with libusb and the SDL HIDAPI driver.
2026-06-10 13:07:47 -07:00