Commit Graph

20231 Commits

Author SHA1 Message Date
SDL Wiki Bot
1d9fc5f2c8 Sync SDL3 wiki -> header
[ci skip]
2025-07-17 07:20:27 +00:00
SDL Wiki Bot
1b4fd3aa83 Sync SDL3 wiki -> header
[ci skip]
2025-07-17 07:05:50 +00:00
Sam Lantinga
7510a67159 Fixed typo
Fixes https://github.com/libsdl-org/SDL/issues/13373
2025-07-16 19:31:10 -07:00
Blaž Tomažič
62d82ffc15 fix: don't use CLOCK_MONOTONIC_RAW on Android
Older Android phones have a kernel bug where time is not properly calculated
when calling `clock_gettime(CLOCK_MONOTONIC_RAW, ...)`. The returned time
either has nanoseconds out of range (outside of [0, 999999999]) or the returned
time is not monotonic in regards to previous call or both.

The issue is reproducible in Android Studio on arm64 emulators from at least
Android 7.0 (didn't try older versions) up to including Android 8.1 (kernel
3.18.94). The issue is in the kernel, these are just the versions of Android
emulator with buggy kernels.

The kernel commit that fixed this is [1]. Because this fix was backported to
various LTS releases of kernels it's hard to find out exactly which kernels are
buggy and which not. Therefore always use `CLOCK_MONOTONIC` on Android.

The `CLOCK_MONOTONIC` is slowly adjusted in case of NTP changes but not for
more than 0.5ms per second [2]. So it should be good enough for measuring
elapsed time.

---

An option would be to dynamically select
`CLOCK_MONOTONIC_RAW`/`CLOCK_MONOTONIC` at runtime by checking at init time
that `clock_gettime(CLOCK_MONOTONIC_RAW, ...)` returns nanoseconds in range.
Testing showed that nanosecons are out of range for 999/1000 cases. I guess
this could be good enough for support on older phones.

But because this would introduce a small perf hit by always reading a global
variable for first argument to `clock_gettime` and because `CLOCK_MONOTONIC`
does not have that high time deviation, this commit uses `CLOCK_MONOTONIC` on
Android always. It is also less burden to maintain.

---

[1] dbb236c1ce
[2] https://github.com/torvalds/linux/blob/master/include/linux/timex.h#L136
2025-07-16 10:36:14 -07:00
mitchellcairns
8e5fe0ea61 SInput Timestamp and Protocol Version (#13371)
* Implement Uint32 microseconds timestamp for IMU reporting instead of deltas
* Implement protocol version in feature request response
2025-07-16 10:12:38 -07:00
SDL Wiki Bot
504107ad0e Sync SDL3 wiki -> header
[ci skip]
2025-07-16 01:36:42 +00:00
mitchellcairns
18eeaea054 Implement SInput Device Support (#13343)
This implements a new SDL HID driver for a format developed by Hand Held Legend for their gamepad devices called SInput

Devices that are supported by this change with well-defined mappings

GC Ultimate ( https://gcultimate.com )
ProGCC ( https://handheldlegend.com/products/progcc-kit-wireless-wired-bundle )

The SInput format is documented here: https://github.com/HandHeldLegend/SInput-HID
2025-07-15 18:35:47 -07:00
Sam Lantinga
a53eb5221b Added support for the PDP REALMz Wireless Controller for Switch 2025-07-15 17:41:54 -07:00
Ryan C. Gordon
b3af72f69e emscripten: Respect SDL_HINT_MAIN_CALLBACK_RATE.
Fixes #13345.
2025-07-15 20:36:56 -04:00
Sam Lantinga
1b65f25465 testcontroller: use the correct label for face buttons 2025-07-15 15:52:40 -07:00
Sam Lantinga
08e3758e3f Added paddle bindings for the 8BitDo Pro 3 controller 2025-07-15 10:15:52 -07:00
Sam Lantinga
d53fcab609 Reordered the 8BitDo Pro 3 controller 2025-07-15 10:09:06 -07:00
Ryan C. Gordon
f2ae6503c0 audio: Binding an SDL_AudioStream will set missing formats.
It _must_ have the format set for the opposite side from the device (so
playback needs the src format set, and recording needs the dst format set),
since the stream gets mangled by the device thread if not. So if it has never
been set (stream created with NULL audiospec), just set it to match the device.
If the stream is just meant to buffer and not convert, this is desired
behavior, even if it didn't also fix a bug.

Binding the audio stream will always set the device side's format, as usual;
this does not need to be set by the caller at all.

Fixes #13363.
2025-07-15 06:40:09 -04:00
8BitDo
3c04c88c6e Add support for Pro3
Add support for Pro3
2025-07-15 03:26:08 -07:00
SDL Wiki Bot
d5efb11f97 Sync SDL3 wiki -> header
[ci skip]
2025-07-14 23:50:35 +00:00
Ryan C. Gordon
10004ab0ea hints: Added SDL_HINT_LOG_BACKENDS.
Fixes #13354.
2025-07-14 19:49:38 -04:00
Sam Lantinga
277f91c317 Removed the Mayflash GameCube adapter from the PS3 controller list 2025-07-14 11:30:15 -07:00
Andon M. Coleman
a07cf3ecdc Allow 1 kHz sample rate for DualSense Edge over USB
DualSense Edge natively reports at 1 kHz for all connection types, but gyro sample rate was limited to 250 Hz for USB.
2025-07-14 10:02:19 -07:00
Josh Dowell
0a50b798bf windows: Fix crash when using a system that reports itself as Windows 17763 or newer, but is missing many of the newer dark mode window functions (Linux Mint Cinnamon w/ Proton 7.0.6) 2025-07-13 20:08:47 -07:00
Ryan C. Gordon
2d8fd6bee1 Revert "windows: Use wglSwapLayerBuffers if available."
This reverts commit f286558bae.
2025-07-13 21:40:42 -04:00
Ryan C. Gordon
536126fdcf emscripten: Move over to using Pointer Events for all mouse, pen, and touch.
This allows us to avoid browser mouse emulation for touches, since we provide
our own anyhow.

The other option is to "prevent default" in the legacy touch event handlers we
historically used, to tell the browser not to supply emulation, but we can't
currently tell Emscripten to mark those handlers as not "passive," so as it
stands they are unable to prevent default. Using Pointer Events bypasses this
problem entirely.

Fixes #13161.
2025-07-13 16:06:03 -04:00
Kyle Sylvestre
0f061ff154 remove spoofed SDL_HelperWindow when SDL_VIDEO is off 2025-07-12 07:47:13 -07:00
Kyle Sylvestre
d42217ba26 check SDL_PLATFORM_WINDOWS instead of SDL_VIDEO_DRIVER_WINDOWS when using SDL_HelperWindow 2025-07-12 07:47:13 -07:00
Kyle Sylvestre
a190e3b514 move SDL_HelperWindow outside of video
move to SDL_window.c to prevent relying on SDL_VIDEO
2025-07-12 07:47:13 -07:00
Anonymous Maarten
5e787555e8 ci: build MSVC release binary on windows-2025
(cherry picked from commit 554f08bac3)
2025-07-12 01:54:05 +02:00
Ryan C. Gordon
190afc0f4f gpu: Fixed uninitialized variable in SDL_AcquireGPUCommandBuffer().
Fixes #13191.
2025-07-11 18:18:47 -04:00
Ryan C. Gordon
a81cf566f4 wasapi: Force enumerated audio devices to report themselves as float32 format.
This is what they'll end up being when used through WASAPI in shared mode,
regardless of what the hardware actually expects.

Reference Issue #12914.
2025-07-11 16:10:47 -04:00
Sam Lantinga
92e8224d32 Fixed build 2025-07-11 13:05:37 -07:00
Sam Lantinga
0b2e389ee3 Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 12:34:14 -07:00
Sam Lantinga
937e8d55a4 Set hwndTarget to NULL when unregistering raw input
Fixes https://github.com/libsdl-org/SDL/issues/13335
2025-07-11 12:14:36 -07:00
Ryan C. Gordon
9af93abd4f cocoa: Don't minimize fullscreen windows for a modal file dialog.
macOS sends a focus loss event when the dialog is created, which causes SDL
to try to minimize the window, which confuses the entire system. So in this
special case, don't do the minimization.

Fixes #13168.
2025-07-11 15:05:45 -04:00
Sam Lantinga
f199aafaeb Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 11:55:46 -07:00
Ryan C. Gordon
72f4dd17be x11: Avoid duplicate mouse events when using a pen device.
Fixes #12968.
2025-07-11 14:27:12 -04:00
Ryan C. Gordon
a2dcdfcb2d stdinc: Docs said "macro" but meant "datatype." 2025-07-11 14:24:12 -04:00
SDL Wiki Bot
45cc80f02c Sync SDL3 wiki -> header
[ci skip]
2025-07-11 18:20:01 +00:00
Ryan C. Gordon
515433aa8a android: If various POSIX fsops functions fail, try using AAssetManager.
This specifically affects SDL_EnumerateDirectory and SDL_GetPathInfo. Android
assets are read-only, so no need to do this for things like
SDL_CreateDirectory, etc, and the POSIX SDL_CopyFile() uses SDL_IOStream
behind the scenes, which already supports Android assets.

Fixes #13050.
2025-07-11 14:16:18 -04:00
Ryan C. Gordon
f286558bae windows: Use wglSwapLayerBuffers if available.
It apparently works better (or can work better?) on multimonitor setups
than SwapBuffers.

This should be available back to Windows 95, but just in case, it falls
back to standard SwapBuffers if not available.

Fixes #13269.
2025-07-11 12:29:12 -04:00
Anonymous Maarten
cfb8e591cb cmake: remove /RTC1 from CXX flags when building with SDL_LIBC=OFF 2025-07-11 03:25:58 +02:00
Frank Praznik
11ec0c7a8f hashtable: Fix documentation typos 2025-07-09 12:38:16 -04:00
Wouter Wijsman
c64518f300 PSP: Truncate thread name when passing to sceKernelCreateThread 2025-07-09 17:11:26 +02:00
Ozkan Sezer
fb0e03f262 fix ARM64 linkage with Visual Studio >= 17.14 when SDL_LIBC is disabled
Reference issue:  https://github.com/libsdl-org/SDL/issues/13254

(cherry picked from commit 2fb6abb9ad)
2025-07-09 01:30:55 +03:00
Aleksey Sakovets
6386781351 README-macos.md: replace old API calls 2025-07-07 18:37:19 -04:00
Frank Praznik
ef4b7489ff wayland: Use wl_shm_release when available 2025-07-06 11:28:04 -04:00
Frank Praznik
03fcbb4e46 wayland/events: Names will always be sent before devices and capabilities
Wayland previously didn't specify that the seat name preceded the capabilities, but it is now specified that the name event must always come first. Remove the 'SDL_Set<device>Name()' functions that were only added to accommodate the case of compositors sending the name after the seat capabilities, as this clarification means that they are no longer needed.
2025-07-06 11:28:04 -04:00
Frank Praznik
45fa9dba16 wayland: Use wl_fixes for registry destruction 2025-07-06 11:28:04 -04:00
Frank Praznik
b9ab8cf03d wayland: Add support for the key repeat event (seat v10)
The internal key repeat mechanism already disables itself if the key repeat interval is 0, and SDL tracks and handles the flagging of repeated keys itself, so just map the 'repeated' event to 'pressed'.
2025-07-06 11:28:04 -04:00
Ryan C. Gordon
343ad3eddd ngage: SDL_GetPrefPath allows a NULL org parameter.
Reference Issue #13322.
2025-07-05 12:21:13 -04:00
Frank Praznik
ecdc6f2adb wayland: Ensure that the xdg_surface is always configured after creation
The spec states that xdg_surface must have seen an initial configure event before attaching a buffer, however, this was only being done when initially showing the window, and not after show->hide->show cycle.

Always wait for the initial configure event when (re)creating an xdg_surface as part of the show window sequence.
2025-07-05 12:09:17 -04:00
Michael Fitzmayer
7c11a8cb9f Fix typo: remove redundant character 2025-07-03 13:20:47 +02:00
Anonymous Maarten
f3bf387caf testhotplug+testmouse: exit when pressing ESC key 2025-07-03 02:21:51 +02:00