Compare commits

..

715 Commits

Author SHA1 Message Date
Sam Lantinga
f87239e71e Updated to version 3.4.12 for release 2026-07-01 09:20:42 -07:00
Ryan C. Gordon
39aff4c978 audio: Pass the id, not the obj, to SDL_AudioDeviceDisconnected_OnMainThread.
If a device has disconnected, and the app has quit the audio subsystem before
the queued main thread function has run, the pointer will be bogus by the time
the run occurs. So now it looks up the object from its device ID, and if the
lookup returns NULL, it returns immediately and everything works out.

Reference Issue #14856.

(which might be fixed by this or not.)

(cherry picked from commit 774728b6ff)
2026-06-30 23:29:41 -04:00
Sam Lantinga
2d8ddf333a Get the physical device properties when using an external Vulkan device
Fixes `testffmpeg --sprites 100` when using the Vulkan renderer

(cherry picked from commit dfefce62e2)
2026-06-30 13:00:30 -07:00
Sam Lantinga
f321b80e7a Issue a batch when changing render targets in the Vulkan renderer
Otherwise we get rendering artifacts that look like drawing is being applied to the wrong render target

(cherry picked from commit 464b90b475)
2026-06-30 09:01:05 -07:00
Frank Praznik
6f0544dcca wayland: Fix incorrect dereference when sorting icon surfaces
(cherry picked from commit 2f1cf4629c)
2026-06-30 10:16:28 -04:00
Mason Remaley
25e2ec0407 Fixes invalid dereference in animated cursor sort
`Wayland_CreateAnimatedCursor` calls `SDL_qsort` on an array of
type `**SDL_Surface`, not on an array of `*SDL_Surface`. As such the void
pointers in the callback need to be casted to `SDL_Surface **` not
`SDL_Surface *`.

This was likely not caught since it's very unlikely that reading a few
bytes past the end of this array results in reading unreadable memory,
so the only side effect was invalid sort results, which is a bit subtle.

I caught this because I build SDL with UBSAN enabled in my debug builds,
and it trapped when the multiplication of the garbage `SDL_Surface*`
width and heights overflowed. I validated that the change is correct by
adding logs (that have then since been removed) demonstrating that it
was previously comparing garbage, and is now comparing the actual cursor
surfaces.

(cherry picked from commit a168e96cbc)
2026-06-30 09:54:32 -04:00
Sam Lantinga
13a2ea7187 Added a workaround for a crash in NVIDIA drivers when rendering YUV with Vulkan
Fixes https://github.com/libsdl-org/SDL/issues/13878

(cherry picked from commit e0b12bbcea)
2026-06-29 14:18:18 -07:00
Frank Praznik
2ccd76818e win32: Use the current cursor coordinates when processing WM_NCACTIVATE
The event coordinates returned by GetMessagePos() for WM_NCACTIVATE are out of date if the cursor moved while an overlay was active, and may indicate that the cursor is still in the window when it is not. Always use the current cursor coordinates when processing this message to avoid incorrectly setting mouse focus if the cursor is no longer within the window.

(cherry picked from commit 0a8ccb11eb)
2026-06-29 12:39:36 -04:00
Sam Lantinga
1326f406a6 Removed unnecessary assert in WIN_SetWindowOpacity()
Fixes https://github.com/libsdl-org/SDL/issues/15896

(cherry picked from commit f0e99e7c7f)
2026-06-27 21:10:47 -07:00
BZL
03d17f40bf Add Void GENESIS controller support
Add AndGAMER/Void Gaming USB IDs for Void GENESIS.

Recognize the Void GENESIS SInput VID/PID pair and set its device name.
Add DirectInput gamepad mappings for the wired and dongle DirectInput modes.

(cherry picked from commit 111bb79bf8)
2026-06-27 20:12:20 -07:00
Cameron Gutman
ca7db3216d keyboard: Limit text input event size for sdl2-compat
(cherry picked from commit 32f460d357)
2026-06-27 17:34:52 -07:00
Frank Praznik
ce68c297f0 cmake: Print a warning if the libdecor development library is missing
libdecor is required for window decorations on Wayland when the toplevel decoration protocol is not supported, such as on GNOME and Weston. Warn if the development library can't be found, unless it was explicitly disabled.

(cherry picked from commit 607eb5206e)
2026-06-25 09:47:36 -04:00
Ryan C. Gordon
db6d9d5c01 docs: warn not to destroy an SDL_AudioStream during its callback.
Fixes #15871.

(cherry picked from commit 0b692f64b0)
2026-06-23 13:50:57 -04:00
Ryan C. Gordon
929f060b68 examples/input/03-gamepad-polling: Render axes in blue.
It's easier to see against white than yellow was.

(cherry picked from commit d7e25c92c0)
2026-06-19 14:36:14 -04:00
Ryan C. Gordon
76db4ee3e7 wikiheaders: Fix links in manpage generation.
Fixes #15665.

(cherry picked from commit 7134ed5c1c)
2026-06-18 13:46:36 -04:00
Frank Praznik
1de0c4e0f0 wayland: Attach EGL objects to custom and external surfaces during reconfiguration
They are required when using EGL with an external surface.

(cherry picked from commit 06795b00ad)
2026-06-18 10:58:24 -04:00
Frank Praznik
2dc9006711 wayland: External windows are never hidden
Needed for the GPU renderer to function properly.

(cherry picked from commit dbfddb6409)
2026-06-18 10:58:24 -04:00
Vicki Pfau
3bbbc946de Fix discrete Joy-Con mappings on Linux
(cherry picked from commit ca67f19c8f)
2026-06-17 20:49:55 -07:00
SDL Wiki Bot
3e2bf29153 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit ae429cf5ee)
2026-06-17 16:52:15 -07:00
Sam Lantinga
c548acee53 Added SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD
(cherry picked from commit c9b6581210)
2026-06-17 16:49:17 -07:00
tmkk
31e08f0bad hidapi: do not enumerate XInput devices owned by a kernel driver via libusb on macOS
(cherry picked from commit cee2cb8ed1)
2026-06-17 06:53:08 -07:00
Anonymous Maarten
f7aeabb980 doc: use testspriteminimal instead of testgles in android example
testgles depends on SDL_test so would need ../src/test/*.c as an additonal argument.

(cherry picked from commit da8aa39222)
2026-06-16 16:57:15 -07:00
Roman Fomin
7879d0b7b3 Fix the "redundant redeclaration" warning for __debugbreak when using MinGW (#14264)
(cherry picked from commit b0a9aa3db0)
2026-06-16 15:59:54 -07:00
Pierre de La Morinerie
f53ea45d43 SDL_joystick: add Austgame adapter to gamecube devices
"Austgame GameCube to USB converter" is an GameCube-to-USB adapter.

(cherry picked from commit 51e214a012)
2026-06-14 08:44:01 -07:00
Nintorch
b7c986a164 Add normalized name for Emscripten joysticks
(cherry picked from commit 7bbd9d5c2c)
2026-06-13 07:20:53 -07:00
arnau.nau
7e0285b482 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.

(cherry picked from commit 46d0ecead0)
2026-06-13 07:18:41 -07:00
Nintorch
6cdec7ac09 Fix Xbox One controller detection on the web
(cherry picked from commit 4f031ea5da)
2026-06-12 09:04:16 -07:00
Nintorch
1731bb0d8e Fix web crash for joystick without vibration
(cherry picked from commit 4a0d66116f)
2026-06-12 08:53:45 -07:00
Nintorch
fdab62170e Fix JoyCon pair type detection on the web
(cherry picked from commit 5e54decf53)
2026-06-12 07:44:56 -07:00
Nintorch
d4d6f50736 Don't modify the driver signature on the web
(cherry picked from commit 95dafa2bcd)
2026-06-12 07:43:29 -07:00
Brenton Bostick
837e3d98c9 fix typos
(cherry picked from commit 65433383a6)
2026-06-12 07:42:24 -07:00
Frank Praznik
b7b1f7843d 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.

(cherry picked from commit 34af24276f)
2026-06-12 10:26:51 -04:00
Sam Lantinga
a5e02a0927 Fixed error C2440: 'function': cannot convert from 'int (__cdecl *)(libusb_context *,libusb_device *,libusb_hotplug_event,void *)' to 'libusb_hotplug_callback_fn'
(cherry picked from commit df294acbae)
2026-06-10 13:29:30 -07:00
Sam Lantinga
7ad1368224 Added hotplug detection when using libusb
Also switched to a single thread for libusb read operations instead of one thread per device

(cherry picked from commit 1475239328)
2026-06-10 13:12:36 -07:00
Sam Lantinga
fcb29e4fb4 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.

(cherry picked from commit 18fc4d931a)
2026-06-10 13:12:29 -07:00
Anonymous Maarten
d124bd44cc ci: run GDK on older Windows environment
>
> The GDK version which is set up by build-scripts/setup-gdk-desktop.py does not support Visual Studio 2026

(cherry picked from commit 513b5d067d)
2026-06-10 18:47:09 +02:00
expikr
2e604c2bbb don't fetch timestamp again
(cherry picked from commit ed43ec0277)
2026-06-10 06:27:29 -07:00
Alejandro Perez
dd1032282e Add Corsair as valid PS controller
(cherry picked from commit 14b0e9d922)
2026-06-09 19:50:04 -07:00
Ryan C. Gordon
6a854e035f audio: Split device "zombie" status into multiple stages.
Otherwise, a device that is disconnected in the standard audio device thread
might keep failing WaitDevice() in a tight loop, each one generating a new
main thread callback. In normal situations, this is wasteful, but if the
app isn't pumping the event loop quickly (or at all!), this will quickly eat
up all the memory in a machine.

Now we note that the device is zombified right away, and device thread
iteration will use this to replace the implementation with the Zombie
equivalents once it owns the device lock.

The main thread callback will progress to device->zombie==2, which it uses to
decide if this is a duplicate disconnect notification. Since it also owns the
lock at this point, it takes the moment to set the Zombie implementation up,
too.

This allows things (like the WASAPI backend) to check for a non-zero zombie
state immediately without having to worry if the main thread callback ran, and
for the standard audio threads to also move to the Zombie implementation
without waiting on that callback.

(The Zombie implementation is used to make a dead device keep processing, so
things that need the audio device to make progress to function will keep
working, and things blindly pushing to an audio stream won't queue up endless
data that isn't being consumed.)

Fixes #15745.

(cherry picked from commit 6136358840)
2026-06-09 20:58:04 -04:00
Sam Lantinga
7cb03cfdc5 Fixed a hang reading the Xbox report descriptor on macOS
(cherry picked from commit 64998d2bc8)
2026-06-09 11:13:20 -07:00
Sam Lantinga
94ba53758f Fixed the Xbox 360 Controller showing as a Steam Virtual Gamepad on macOS
(cherry picked from commit c62cc657a2)
2026-06-09 10:34:15 -07:00
QwertyChouskie
c3fda242fd SDL_hidapi_xbox360.c: Fix Y axis inversion on macOS (#15792)
Originally, macOS had opposite Y axis inversion as every other platform, likely to correct for an issue with the virtual gamepad reported by the old 360Controller driver.

Wired Xbox 360 controllers using native macOS drivers were first reported to be broken in https://github.com/libsdl-org/SDL/issues/11002.  The inversion was removed in 7da728a642, presumably breaking 360Controller usage, but fixing wired 360 controller using the new native support in macOS 15 and above.  However, this change was reverted without explanation in d7b1ba1bfc which added explicit support for the Steam Virtual Gamepad.  Presumably, Steam on macOS reports inverted Y axes to match what SDL expected on the platform.  However, this reversion broke the native macOS controller support.  The incorrect inversion also breaks using off-brand 360-class gamepads via the libusb backend of HIDRAW.

(cherry picked from commit 157c839139)
2026-06-09 10:15:20 -07:00
QwertyChouskie
3ca28ce521 Respect SDL_HINT_JOYSTICK_MFI
(cherry picked from commit 0bd95b0430)
2026-06-09 07:34:40 -07:00
Sanjay Govind
43fa2bdcad Add GIP vids and pids for stage tour instruments (#15788)
(cherry picked from commit 3f80c0b82a)
2026-06-08 22:08:53 -07:00
Sanjay Govind
218522e123 Add PID for red octane games, as they support sony detection
(cherry picked from commit 205777210e)
2026-06-08 20:24:23 -07:00
Nintorch
0ccd792a5d Add mappings for NES Switch controllers on Linux
(cherry picked from commit 2fd15d9e0d)
2026-06-05 08:56:45 -07:00
Zizin13
3b6f122830 Fix DirectInput POV handling for devices with extra hats
(cherry picked from commit 7341f04a12)
2026-06-04 12:23:49 -07:00
Thad House
b152feee3f Enable extra player LED sets for PS5 Controllers
(cherry picked from commit 0c8feecce6)
2026-06-04 08:05:59 -07:00
Kadir
bc36c05bfe Fix java.lang.NoSuchMethodError: no static method "Lorg/libsdl/app/SDLActivity;.showFileDialog([Ljava/lang/String;ZZI)Z" on release build 2026-06-03 07:05:59 -07:00
Sam Lantinga
dd9c521cd1 Fixed java.lang.NullPointerException
From @AntTheAlchemist:
This is an interesting one, on a Xiaomi MiTV. Caused by a camera device, full stack:
android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args -> org.libsdl.app.HIDDeviceManager$1.onReceive -> handleUsbDeviceAttached -> connectHIDDeviceUSB -> getSerialNumber -> android.hardware.usb.UsbDevice.getSerialNumber -> android.hardware.usb.IUsbSerialReader$Stub.onTransact -> com.android.server.usb.UsbSerialReader.getSerial -> UsbUserPermissionManager.checkPermission -> hasPermission -> isCameraDevicePresent

(cherry picked from commit 42fc082b5e)
2026-06-02 16:53:02 -07:00
Sam Lantinga
ad9fcae3ad Handle java.util.ConcurrentModificationException while unregistering sensor listeners
We're still seeing this frequently when unregistering PlayStation controller sensors. We don't know what else is modifying the sensor list, but if we end up getting this exception we'll retry after a short sleep.

(cherry picked from commit 75270a4264)
2026-06-02 16:53:02 -07:00
Simon McVittie
104fe038eb workflows: Stop building for Steam Runtime 3 on arm64
The experimental Steam Linux Runtime 3.0 (arm64) container is being
phased out, so games that want native arm64 binaries should upgrade to
Steam Linux Runtime 4.0.

steamrt/tasks#1032

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d834351d69)
2026-06-02 12:22:07 -07:00
Nintorch
c2567e5db5 Fix web joystick vibration (again)
(cherry picked from commit 96c03dc66e)
2026-05-31 14:28:04 -07:00
Nintorch
825d6f8232 Fix web joystick vibration on Safari
(cherry picked from commit e0eb40f65f)
2026-05-31 14:27:52 -07:00
Sam Lantinga
48045fae0b Updated to version 3.4.11 for development 2026-05-31 10:48:34 -07:00
Sam Lantinga
8e37db5e79 Updated to version 3.4.10 for release 2026-05-31 10:38:41 -07:00
Ryan C. Gordon
543072cd50 docs: Update documentation for SDL_stack_free.
Reference Issue #15727.

(cherry picked from commit 098a066f20)
2026-05-30 22:50:12 -04:00
Ryan C. Gordon
f5ed7160bf stdinc: make SDL_stack_free evaluate to ((void)(data)) when alloca is usable.
Fixes #15727.

(cherry picked from commit 67e6f5b7ee)
2026-05-30 22:46:31 -04:00
Cameron Gutman
6dbdb94cae joystick: Fix conflicting rumble and LED on Sony PS4 gamepads
(cherry picked from commit 189877b1d3)
2026-05-30 17:21:03 -07:00
Ryan C. Gordon
b3dca03ebf SDL_migration.cocci: Add joystick/gamepad event state functions.
(cherry picked from commit e1aaebff87)
2026-05-30 14:06:15 -04:00
Ryan C. Gordon
5b54dcc16d SDL_migration.cocci: add SDL_JoystickGetGUIDString -> SDL_GUIDToString.
(cherry picked from commit 0cf06bf131)
2026-05-30 13:50:16 -04:00
Vicki Pfau
30c2648fbe joystick: Fix underflow with 0 delta timestamp
Some sensors will occasionally report two identical timestamps in a row.
This leads to the timestamp wrapping calculation to underflow, subtracting
0x80000000 from the timestamp whenever it happens. By adjusting the wrap
test, we can just directly add zero to the timestamp, fixing the underflow.

(cherry picked from commit 687a59f277)
2026-05-29 21:48:44 -07:00
replicacoil
11cb97888b Added rumble to Gamecube Adapter PC_Mode (#15431)
(cherry picked from commit c43ab978fd)
2026-05-29 17:29:19 -07:00
Sam Lantinga
149fce547f Send SDL_EVENT_WINDOW_EXPOSED when the GPU renderer swap chain is resized
In this case the current frame being rendered doesn't match the swapchain size and the application should re-render the frame.

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

(cherry picked from commit 2b0df96f25)
2026-05-29 14:37:38 -07:00
Sam Lantinga
1289fdded2 render: an empty clip rect should clip all drawing
Added a test to validate this and fixed the Metal renderer

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

(cherry picked from commit e04bfb4c6e)
2026-05-29 13:59:23 -07:00
Sam Lantinga
f38994c15c Fixed Steam Controller not detected on macOS under Steam
(cherry picked from commit 8a701808a6)
2026-05-29 12:13:54 -07:00
tmkk
5e55c12d78 Detect steam virtual gamepads more accurately on macOS
(cherry picked from commit bbcc205de9)
2026-05-29 12:13:49 -07:00
tmkk
cefdc61f5e Bring back support for 360Controller driver on macOS
(cherry picked from commit 50d0e2ede2)
2026-05-29 12:13:10 -07:00
Sam Lantinga
bfdd7ee8b4 Fixed detecting the Steam virtual gamepad when HIDAPI is disabled
(cherry picked from commit ec0066aa0b)
2026-05-29 10:56:38 -07:00
Sam Lantinga
45c28b2eb9 Added HIDAPI support for the PDP Afterglow Wave Wireless Controller for Switch
(cherry picked from commit ed6e03436e)
2026-05-29 09:56:21 -07:00
Sam Lantinga
6675ea9147 Added DEBUG_STEAM_PROTOCOL for the new Steam Controller
(cherry picked from commit 634dff3725)
2026-05-28 19:51:56 -07:00
Sam Lantinga
53ae9c9370 metal: fixed reading textures with format SDL_PIXELFORMAT_RGBA128_FLOAT
(cherry picked from commit 113e97e193)
2026-05-28 11:51:30 -07:00
Cameron Cawley
011f1c2340 Support 16-bit packed texture formats with the Metal renderer
(cherry picked from commit 4af4c97e44)
2026-05-28 11:51:01 -07:00
Sam Lantinga
7b0f45186b Fixed Steam Controller rumble on Android (thanks @Packetdancer!)
(cherry picked from commit 7103ed4167)
2026-05-28 11:46:21 -07:00
Sam Lantinga
05d140a128 Add support for new Steam Controller input report on mobile devices
(cherry picked from commit f6ffa69890)
2026-05-28 11:46:05 -07:00
Sam Lantinga
8d5ee8b38c Removed unnecessary log message
(cherry picked from commit f1dd6db701)
2026-05-28 11:45:54 -07:00
Sam Lantinga
d960a2279a Fixed Steam Controller BLE report size
(cherry picked from commit 7b27056ea0)
2026-05-28 11:45:50 -07:00
Sam Lantinga
c6a81a0e4c Make sure we report ID_TRITON_CONTROLLER_STATE_BLE on iOS
(cherry picked from commit 9b7f55be89)
2026-05-28 11:45:44 -07:00
Rachel Blackman
69db06bcd2 Handle the Amazon Fire TV's weird Bluetooth behavior
(cherry picked from commit 418960bb4e)
2026-05-28 11:44:52 -07:00
Sam Lantinga
7bfac42489 Removed spurious whitespace
(cherry picked from commit 815fd4bf45)
2026-05-28 11:44:45 -07:00
Rachel Blackman
8c12ce1760 Add support for new Steam Controller on Android (#15044)
(cherry picked from commit 46e553a44c)
2026-05-28 11:41:57 -07:00
Sam Lantinga
463d8ddf85 Fix mistyped output report message for Steam Controller
This caused hiccups in BlueZ BT driver for Linux

(cherry picked from commit bb3c61390a)
2026-05-27 18:21:13 -07:00
Sam Lantinga
385f7db161 Add support for new Steam Controller input report
(cherry picked from commit f7a8801227)
2026-05-27 18:21:13 -07:00
Rachel Blackman
f6f1376cbd OpenVR: Actually quit correctly if we get a close/quit message.
(cherry picked from commit a7ecd5f777)
2026-05-27 17:40:58 -07:00
Sam Lantinga
9fe4e5cc87 Revert "android: fixed a possible joystick-related deadlock on application termination"
This reverts commit 6b4ae68460.

It turns out this deadlock is possible for any joystick event delivery combined with an event watcher that locks joysticks. I'm reverting this change for now, and will be working on a better global solution for this problem.

(cherry picked from commit 76560f9e47)
2026-05-27 13:08:45 -07:00
Ryan C. Gordon
b8601dc8a7 filesystem: Implement SDL_GetExeName() for all platforms.
(cherry picked from commit d7ba3efe6b)
2026-05-27 15:42:41 -04:00
Ryan C. Gordon
11e13dc4a5 gdk: Just use WIN_GetModulePath().
There's no need to use the "A" version of GetModuleFileName on GDK; it returns
a UTF-8 string directly on this platform, but we can still use the UTF-16 "W"
version and cut down on code duplication.

This code runs once and caches the results, so we can take the one-time string
conversion overhead.

(cherry picked from commit 6b780c5ff9)
2026-05-27 15:42:20 -04:00
Frank Praznik
5dc7a5daed x11: Fix boolean/enum comparison
This could set the pending flag even if there was no state change requested, which would cause errant sync timeouts in certain situations.

(cherry picked from commit 6a3b0413dc)
2026-05-27 12:16:01 -04:00
Ryan C. Gordon
eee7164d9d x11: SetupWindowData shouldn't add to videodata->windowlist until success.
Fixes #15676.

(cherry picked from commit 22fb9edd5c)
2026-05-27 11:45:31 -04:00
zanadoman
a21c31aea1 GPU: Return early in SDL_WaitForGPUFences if num_fences is 0
(cherry picked from commit d7b1255484)
2026-05-27 08:24:53 -07:00
Rachel Blackman
a97d8b3848 Ensure we release exclusive USB access to controllers when backgrounded. #15694
(cherry picked from commit ac177763aa)
2026-05-26 17:58:09 -07:00
Ryan C. Gordon
58c2de8e25 metadata: SDL_GetAppMetadataProperty() now uses SDL_GetExeName().
(for SDL_PROP_APP_METADATA_NAME_STRING if unset. If SDL_GetExeName() returns
NULL, it'll fallback to good ol' "SDL Application", as usual.)

Fixes #15692.

(cherry picked from commit a49ba90257)
2026-05-26 20:34:28 -04:00
Ryan C. Gordon
2621d7aab2 filesystem: Added SDL_GetExeName().
core/unix had a more-limited copy of filesystem/unix's implementation, called
SDL_GetExeName(). Replace that with a real implementation in filesystem, and
allow each platform to implement it as appropriate.

Implemented for Unix and Windows; most implementations are currently FIXME
stubs at the moment.

Reference Issue #15692.

(cherry picked from commit 7d29ce8e31)
2026-05-26 20:33:44 -04:00
NY00123
597694e4a1 Android: Skip duplicated joystick axes during poll
Resolves https://github.com/libsdl-org/SDL/issues/15414

(cherry picked from commit 199d509820)
2026-05-26 15:55:02 -07:00
Frank Praznik
483d86588c video: Only ignore modes with a lower color depth in SDL_GetClosestFullscreenDisplayMode()
If a mode with a closer refresh was found, but it had the same color depth as the current best match, it was being dropped. Only ignore the new mode if the color depth is below the current best match.

(cherry picked from commit cd0b796a6e)
2026-05-26 18:28:41 -04:00
Sam Lantinga
33ea9c3e63 Don't use the HIDAPI driver with Backbone One PlayStation Edition Gen 2
This product doesn't appear to use the DualSense protocol. On Android this shows up as two interfaces that don't send reports that we can parse.

(cherry picked from commit a84dafd5b9)
2026-05-26 14:17:19 -07:00
Ryan C. Gordon
bc8141ba6e docs: Update notes on SDL_AudioStream format management.
Fixes #15688.

(cherry picked from commit d0f6264f95)
2026-05-26 09:57:32 -04:00
Anonymous Maarten
452348acf8 _uitoa does not exist
(cherry picked from commit 08e338f45c)
2026-05-25 18:40:43 +03:00
Ryan C. Gordon
dd21daa681 examples/demo/04-bytepusher: go back to showing help text on load failures.
If the VM was already running, and then a file failed to open at all (a
directory was dropped on the window, etc), this wouldn't go back to showing
the help text.

(cherry picked from commit 6c55fad411)
2026-05-23 23:59:30 -04:00
Ryan C. Gordon
3d92675bdb examples/demo/04-bytepusher: Remove render target.
This doesn't need a render target to function. The comment suggested it was
needed to make debug text look better when scaled, but maybe logical
presentation used to do linear scaling exclusively at the time?

(cherry picked from commit 800f347e5e)
2026-05-23 23:59:28 -04:00
Sam Lantinga
5720f54059 Fixed building with older versions of GameInput
(cherry picked from commit f8d5628163)
2026-05-22 16:07:46 -07:00
Jason Millard
efe6062cf4 iOS: Fix SDL_EVENT_DROP_FILE lost on cold start from URL open
(cherry picked from commit 290f0c831f)
2026-05-22 07:17:06 -07:00
Bitwolf
386be0070b Update Famicom controllers to a more user friendly name.
(cherry picked from commit 2f13731d23)
2026-05-22 07:15:35 -07:00
Vittorio Romeo
e8eba4a406 emscripten: dedupe keyboard event listeners across multiple windows
(cherry picked from commit 7f03da9588)
2026-05-22 07:11:44 -07:00
kholo
05191b0c7d Ignore Huion Tablet Kamvas Pro 22
(cherry picked from commit 2bb6df90ad)
2026-05-22 07:06:35 -07:00
Sam Lantinga
9a1ba9f811 android: fixed a possible joystick-related deadlock on application termination
(cherry picked from commit 6b4ae68460)
2026-05-21 12:20:50 -07:00
Sam Lantinga
cbea661f54 Fixed build
(cherry picked from commit fe1918a47f)
2026-05-21 10:05:29 -07:00
Sam Lantinga
48888a3865 Fixed Ipega controllers being ignored in keyboard mode (thanks @AntTheAlchemist!)
(cherry picked from commit 13f91a67fc)
2026-05-21 09:56:53 -07:00
Sam Lantinga
b59f09809d Process repeated joystick key events on Android
This prevents them from being interpreted as keyboard keys by the Java code, and if internally we are treating them as keyboard keys, they'll be repeated properly.

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

(cherry picked from commit 3545bad589)
2026-05-21 06:53:37 -07:00
Sam Lantinga
fb8bf997e9 android: handle sensor registration synchronized in one place
(cherry picked from commit 47c8dcc968)
2026-05-20 15:55:41 -07:00
Sam Lantinga
5bd0eb068c Fixed a rare crash on Raspberry Pi when creating a window
(cherry picked from commit 19d73016e8)
2026-05-20 15:11:26 -07:00
Sam Lantinga
257de23efc Fixed a rare crash on Raspberry Pi when creating a window
(cherry picked from commit 0dbd9d2a65)
2026-05-20 14:58:41 -07:00
Frank Praznik
b94ffff046 x11: Ignore slave button presses when the window lacks keyboard focus
XInput2 can send slave button presses before FocusIn events, which can confuse the click-through suppression logic. A window must have keyboard focus to grab the mouse anyway, so ignore slave presses when lacking keyboard focus.

(cherry picked from commit ef9a5b7040)
2026-05-20 13:08:47 -04:00
Frank Praznik
6f9205a3c3 x11: Reject click-through button events based on serial
XInput2 may send mouse buttons presses on both the master and slave devices, and the click-through button event should be ignored on both if required.

(cherry picked from commit 8371c09aa7)
2026-05-20 13:08:40 -04:00
Ryan C. Gordon
dcf8f960c7 assert: fixed compiler warning with LLVM + x86_64-pc-windows-msvc target.
Fixes #15578.

(cherry picked from commit 9a56bc66b5)
2026-05-20 13:03:31 -04:00
Ryan C. Gordon
9a3eab45f9 README-migration: Note that render target support is not universally available.
Fixes #15474.

(cherry picked from commit f8dab6ad51)
2026-05-20 12:52:35 -04:00
Sam Lantinga
69300875ec Allow setting NULL palette on any surface
Fixes https://github.com/libsdl-org/SDL/issues/15654

(cherry picked from commit cfed9b3aca)
2026-05-19 14:22:37 -07:00
Ozkan Sezer
6545e5b0b8 SDL_rawinputjoystick.c: fixed a type redefinition error
(cherry picked from commit f19dca3ca0)
2026-05-19 18:55:50 +03:00
Ozkan Sezer
eb8caad5a4 SDL_windows_gaming_input.c: work-around to build against old SDKs.
Fixes https://github.com/libsdl-org/SDL/issues/15646

(cherry picked from commit 42c4a0e30f)
2026-05-19 17:26:28 +03:00
Ozkan Sezer
2f660cb332 hidapi/netbsd: import mainstream commit 7e994d8671:
https://github.com/libusb/hidapi/commit/7e994d8671 - authored by
Izumi Tsutsui:

netbsd: check not only addr 0 but also addr 1 to find root hubs

On NetBSD xhci(4) uses 'addr 0' for the root hub but all drivers for
other host controllers use 'addr 1' for the root hub.
 https://gnats.netbsd.org/60073

(cherry picked from commit 169480a352)
2026-05-19 17:23:14 +03:00
Kuratius
49aa0c0667 Fix touchpad finger detection on Steam Deck
(cherry picked from commit 6ed1de089c)
2026-05-19 06:54:09 -07:00
Ozkan Sezer
b938acab19 SDL_wasapi.c: added comment about SDL_AudioClientProperties workaround
(cherry picked from commit 48fe7b7d6a)
2026-05-19 11:21:24 +03:00
Frank Praznik
3b73938b5f video: Windows keep any position set when in fullscreen after leaving fullscreen
Adds an automated test for the behavior as well.

(cherry picked from commit f31ca02723)
2026-05-18 09:10:25 -07:00
Susko3
edad1c5563 Properly fix cursor position in Korean IME
(cherry picked from commit b608108593)
2026-05-18 09:02:23 -07:00
7aGiven
89fa8a4c0c fix Korean caret position
(cherry picked from commit 8e6fed2cbf)
2026-05-18 09:02:23 -07:00
Ahmed
3c45d1361a examples: Fix float division
(cherry picked from commit b5ac641372)
2026-05-18 09:00:29 -07:00
Ozkan Sezer
afbbfc6e98 wasapi: workaround that AudioClientProperties->Options not being available in old SDKs
Closes: https://github.com/libsdl-org/SDL/issues/15641.

(cherry picked from commit bf03728873)
2026-05-18 18:56:52 +03:00
7aGiven
7a4cce82eb WM_IME_SETCONTEXT not set 0
(cherry picked from commit 296231e999)
2026-05-18 07:05:26 -07:00
Kuratius
d147bb2a06 Fix Steam Controller 2 touchpad finger detection (#15644)
(cherry picked from commit a20530cf15)
2026-05-18 07:04:16 -07:00
Sam Lantinga
85d86dd72c Fixed deadlock introduced by 7222c04fbf
It turns out this change causes a deadlock:
The main UI thread calls synchronized handleMotionEvent() which then calls SDL_LockJoysticks()
The main app thread calls SDL_LockJoysticks() and then synchronized pollInputDevices()

(cherry picked from commit 8c89a076a7)
2026-05-17 12:22:37 -07:00
Sam Lantinga
da76e438be Reapply "Change controller sensor state on the main UI thread on Android"
This reverts commit 02975994c1.

Accidentally reverted the wrong commit

(cherry picked from commit b19ecb4032)
2026-05-17 12:16:07 -07:00
Sam Lantinga
59b38dfe85 Revert "Change controller sensor state on the main UI thread on Android"
This reverts commit c362f1341f.

It turns out this change causes a deadlock:
The main UI thread calls synchronized handleMotionEvent() which then calls SDL_LockJoysticks()
The main app thread calls SDL_LockJoysticks() and then synchronized pollInputDevices()

(cherry picked from commit 02975994c1)
2026-05-17 12:12:20 -07:00
Ozkan Sezer
2e8567bdeb SDL_render_d3d11.c: fix another bad use of SDL_FUNCTION
(cherry picked from commit cbd2917324)
2026-05-17 21:37:00 +03:00
Ozkan Sezer
f689caed82 SDL_render_d3d12.c: revert an unintended change from commit d70578b9aa
(cherry picked from commit f76b736e28)
2026-05-17 20:29:28 +03:00
Frank Praznik
bf7c5e2df2 wayland: Implement Wayland_AcceptDragAndDrop()
This simply toggles a flag that rejects DnD offers if false. Events were previously dropped silently, but rejecting the offer makes some desktops display a proper icon when the drop will not work.

(cherry picked from commit 336d07c2b7)
2026-05-17 11:52:58 -04:00
Ozkan Sezer
e03ee2f0d9 SDL_opengl_glext.h, src/video/directx/d3d12.h: revert unintended changes from commit d70578b9aa
(cherry picked from commit 75c94e9b31)
2026-05-17 16:30:30 +03:00
Tap
273eeebe71 Correct steam triton haptic commands
The listed report IDs are incorrect - there is no skipped ID

(cherry picked from commit 1f7a42a7b9)
2026-05-17 06:24:22 -07:00
Christian Semmler
581c18f693 emscripten: Fix crash on Safari when probing gamepad rumble support
Safari's older Gamepad API exposes `vibrationActuator` with `playEffect`
and `reset` but no `effects` enumeration array. The probe added in
651136ac7 dereferences `vibrationActuator['effects']['includes']`
unconditionally, throwing `TypeError: undefined is not an object` on
every Safari client that opens a connected gamepad. Add the missing
`['effects']` null check so the probe returns false on Safari instead
of aborting.

(cherry picked from commit db7ac820f9)
2026-05-16 15:48:06 -07:00
ceski
f30c0e4ee2 Add Steam Deck capacitive touch sticks, trackpad clicks, and mapping (#15612)
(cherry picked from commit 2ebf23014f)
2026-05-16 09:04:44 -07:00
ceski
cdbc651f65 Add Steam Controller mapping (#15601)
Also fixed Hori QAM button mapping

(cherry picked from commit c00d7b4bf5)
2026-05-15 19:18:56 -07:00
John Schoenick
b8547af466 unix: Fix infinite looping in SDL_FriBidi_Process if len > 127
start/end should be FriBidiStrIndex here -- using FriBidiLevel makes
them `signed char` and the loop here will become infinite if `end` is
> 127.

(cherry picked from commit 0ffb0bdd87)
2026-05-15 15:40:55 -07:00
Rachel Blackman
819bb962fa Add Gamesir Supernova in Xinput mode to controller list
(cherry picked from commit d83e7bf79e)
2026-05-15 13:26:10 -07:00
Evan Hemsley
f3281f6e3d GPU: Set missing fields on Vulkan swapchain texture (#15606)
(cherry picked from commit 86296ac8f0)
2026-05-15 11:44:33 -07:00
Sam Lantinga
a7f93c5c55 Detect the GameSir Super Nova in Xbox 360 mode
(cherry picked from commit a95ce7e734)
2026-05-15 10:13:53 -07:00
Anthony
e5246aaa6a Update showFileDialog in proguard-rules.pro
to match changes in 439ffd1

(cherry picked from commit bd146867e4)
2026-05-15 08:59:51 -07:00
Anthony
b87c1101e0 Add joystickSetSensorsEnabled to proguard-rules.pro
(cherry picked from commit c94b1435c7)
2026-05-15 08:44:19 -07:00
Anonymous Maarten
f00b0291b3 surface: cannot set a palette to a non-indexed surface
This fixes a UBSAN warning later in this function where it calculates
(1 << SDL_BITSPERPIXEL(surface->format)). The bpp might be >= 32 and
out of range for a bit shift.

(cherry picked from commit d5af35e3fb)
2026-05-14 20:55:02 -07:00
Rachel Blackman
b84e981ed8 Fix HIDAPI support for Flydigi Vader 5 Pro (#15594)
(cherry picked from commit eb340388fc)
2026-05-14 17:33:36 -07:00
Evan Hemsley
ee49e69ed7 GPU: Refactor Vulkan barriers to fix defrag segfault (#15593)
(cherry picked from commit f286e420af)
2026-05-14 17:02:13 -07:00
ceski
1226f4a56d Add Steam Controller touchpads, capacitive touch for sticks, and grip sense (#15528)
(cherry picked from commit f3faf67c64)
2026-05-14 16:30:02 -07:00
Brenton Bostick
775a8d0ef7 make sure #endif comment matches the macro name
(cherry picked from commit 3ac4e684ab)
2026-05-14 16:29:53 -07:00
Sam Lantinga
2e7bd8902c Use the correct report format for BLE Steam Controller reports
(cherry picked from commit 79f5f674bd)
2026-05-14 16:29:26 -07:00
Cameron Cawley
c9bdfd8fed Replace custom NEON cast macros with vreinterpret_*_*
(cherry picked from commit a3376acc2e)
2026-05-14 09:16:46 -07:00
Vlad-Florin Ilie
f35b77c417 Fix Steam Controller 2026 (triton) rumble (#15558)
(cherry picked from commit b333c04ccc)
2026-05-13 23:42:14 -07:00
Sam Lantinga
f55416bf00 Added controller sensor support for GameInput v3
Verified working with the DualSense controller

(cherry picked from commit 0defb4ddfc)
2026-05-13 23:41:39 -07:00
Sam Lantinga
f37f4f06d5 Fixed windows getting the wrong size when setting size and aspect ratio back to back
(cherry picked from commit 0e5e772ba9)
2026-05-13 20:40:09 -07:00
Sam Lantinga
c02d2b8c73 Added SDL_SendGamepadEffect() support for the new Steam Controller
(cherry picked from commit 4884dbbe56)
2026-05-13 20:15:43 -07:00
Joel Auterson
a8442d38be Add libusb-1.0-0-dev to Linux deps doc
libusb-1.0-0 is needed to enable SDL_HIDAPI_LIBUSB. It does not work with the `libusb-dev` package on Ubuntu, which is for the older version.

(cherry picked from commit c247f06f01)
2026-05-13 18:36:16 -07:00
RaceTheMaSe
3e3d045cf1 hidapi, windows: Fix -Wjump-misses-init warning (#14990)
Clang: jump from this goto statement to its label is incompatible with C++ [-Wjump-misses-init]

(cherry picked from commit ba3274e3a1)
2026-05-13 19:32:50 +03:00
Max Seidenstücker
088a0fc91c Static at beginning
GCC: 'static' is not at beginning of declaration [-Wold-style-declaration]

(cherry picked from commit 0c7d4d5a89)
2026-05-13 19:32:50 +03:00
RaceTheMaSe
9363ecc764 Fix warning: strict prototypes (#14992)
clang: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]

(cherry picked from commit 4f183506f6)
2026-05-13 19:32:50 +03:00
RaceTheMaSe
a7e5870b88 Fix -Wnewline-eof warnings (#14989)
(cherry picked from commit 9fda8f2669)
2026-05-13 19:32:50 +03:00
RaceTheMaSe
5400cdd307 PS2, VITA: Fix void pointer arithmetic warnings (#14995)
(cherry picked from commit 863912aa03)
2026-05-13 19:32:50 +03:00
Sam Lantinga
9848c32d9a Return the touch device name for SDL_TOUCH_MOUSEID
(cherry picked from commit 3dbd3e43e2)
2026-05-13 09:07:51 -07:00
Cameron Cawley
17cf746550 Allow formats with alpha channels for window textures
Because the blend mode is explicitly set to SDL_BLENDMODE_NONE, it doesn't matter if there's a transparency channel in the texture format or not for opaque windows. This ensures that a 32-bit format is used with Metal instead of SDL_PIXELFORMAT_RGB565.

(cherry picked from commit b1f390255a)
2026-05-13 08:52:51 -07:00
Sam Lantinga
a7482a1acb Document that you may receive mouse events with SDL_PEN_MOUSEID
(cherry picked from commit 716c767b7e)
2026-05-13 08:12:42 -07:00
Sam Lantinga
a979d8d060 Use predefined names for constant keyboard and mouse IDs
Fixes https://github.com/libsdl-org/SDL/issues/15563

(cherry picked from commit fcaf5bbf8c)
2026-05-13 08:12:42 -07:00
Anonymous Maarten
2499e1a4c2 stb_image: use SDL_HasSSE2 and <SDL3/SDL_intrin.h> macro's for SSE2 detection
(cherry picked from commit 0457891d50)
2026-05-13 18:10:02 +03:00
Max Seidenstücker
1d8673a885 Void function return
Clang: void function should not return void expression [-Wpedantic]

(cherry picked from commit 144ab4ba99)
2026-05-13 18:10:02 +03:00
Sam Lantinga
ecc33ac29a Change controller sensor state on the main UI thread on Android
Fixes https://github.com/libsdl-org/SDL/issues/15565

(cherry picked from commit c362f1341f)
2026-05-13 08:02:45 -07:00
Sam Lantinga
dfc0e4bb4f Synchronize controller access on the Java side on Android
(cherry picked from commit 7222c04fbf)
2026-05-13 08:02:42 -07:00
Cameron Cawley
08c33bb861 Fix switching modes on RISC OS
(cherry picked from commit 7071efb6a3)
2026-05-12 20:18:26 -07:00
Sam Lantinga
90c68dce38 Removed Wooting 60HE (ARM) from the controller blacklist
Fixes https://github.com/libsdl-org/SDL/issues/15555

(cherry picked from commit f30ec9940a)
2026-05-11 22:11:01 -07:00
Al. Lopez
98ed044509 added additional examples of paddle/misc buttons for Steam Controller (#15544)
(cherry picked from commit 4940345a2e)
2026-05-11 21:45:39 -07:00
Sam Lantinga
ef3196bedd Fixed a crash if we get a HID device with no path
This can happen on Linux if udev_device_get_devnode() fails.

(cherry picked from commit bb4eedd67d)
2026-05-11 16:48:43 -07:00
Rachel Blackman
717bb2dcef Correctly support OG Steam Controller when connected via USB on Android (#15561)
(cherry picked from commit e4a327709d)
2026-05-11 15:23:50 -07:00
Rachel Blackman
7e101bdce9 Ensure Android gamepad mappings don't lose the first button.
(cherry picked from commit fd3cfb97c1)
2026-05-11 12:59:59 -07:00
Evan Hemsley
d348116157 GPU: Fix segfault when copying to Vulkan swapchain (#15543)
(cherry picked from commit 76f8705c12)
2026-05-11 11:42:55 -07:00
Rachel Blackman
2b7c3d8a6c *Only* preserve report byte for feature reports. Oops.
(cherry picked from commit 7ec70d39c4)
2026-05-11 11:33:20 -07:00
Nintorch
b52e6d10ce Ignore Keychron K10 Pro and Huion Tablet_GS1331
(cherry picked from commit 287e2573cd)
2026-05-11 11:11:24 -07:00
Cameron Gutman
a61f02cc88 atomic: Implement loads on MSVC without RMW operations
This fixes faults when loading from read-only memory and avoids
cache line bouncing across cores which reduces performance.

(cherry picked from commit 7439a94ed2)
2026-05-11 06:43:40 -07:00
Frank Praznik
321557f339 x11: Store the mouse button serial for emulated pointer events as well
Otherwise, filtered emulated button events, such as for mouse wheels, can slip through the core event handler.

(cherry picked from commit f48525aa70)
2026-05-10 14:18:06 -04:00
Evan Hemsley
7a827b145a GPU: Validate that 2D textures don't have layers (#15535)
(cherry picked from commit cbe3fbe9f3)
2026-05-07 19:21:10 -07:00
Evan Hemsley
a14da0d366 GPU: Allow depth texture arrays (#15534)
(cherry picked from commit d08ef12b12)
2026-05-07 16:41:09 -07:00
Frank Praznik
7cdf4fd7ee wayland: Ensure window dimensions are greater than zero after adjusting for aspect
Resizing to zero can cause a bad viewport size error.

(cherry picked from commit ba3577f584)
2026-05-07 13:17:29 -04:00
cosmonaut
1ebe9161c3 GPU: Clarify VK_KHR_maintenance9 comment
(cherry picked from commit c8feb29746)
2026-05-07 10:00:07 -07:00
Susko3
5902d6622c Enable text editing events in checkkeys
(cherry picked from commit 2949a0d6d5)
2026-05-07 09:57:22 -07:00
Sam Lantinga
a730905a2b Fixed build
(cherry picked from commit ab19d09939)
2026-05-06 19:42:51 -07:00
Torbjorn Laedre
1704eb5e2e Change 3D texture memory barrier sub-resource range to be maintenance9 compatible.
(cherry picked from commit 5d63a4cad2)
2026-05-06 18:21:31 -07:00
Sam Lantinga
ef9963df0d Don't report 10% battery for Xbox controllers using XInput
(cherry picked from commit 386f198622)
2026-05-06 18:12:29 -07:00
Rachel Blackman
e1513e2d3c Ensure Android hidapi does not drop the report byte (#15527)
(cherry picked from commit f8c364ae74)
2026-05-06 16:08:32 -07:00
Ryan C. Gordon
1ee51f2d88 opengles2: Rework render targets.
Now this keeps one FBO for each SDL_TEXTUREACCESS_TARGET texture, and doesn't
reuse it. We check if the FBO is "complete" once, at creation time, and
setting a render target merely has to bind the right FBO and never look back.

This simplifies the code and removes a guaranteed pipeline stall when setting
a new render target.

Fixes #15524.

(cherry picked from commit 56e0d052f1)
2026-05-06 13:28:03 -04:00
Frank Praznik
9257b7bc13 wayland: Queue the surface frame callback after the initial commit
Some compositors may dispatch this too early, during the initial empty commit, when subsurfaces are attached to a toplevel window, but a buffer has yet to be committed to the parent surface. Don't set the frame callback until the initial empty commit is done, so it will be called when the actual parent surface frame is committed.

(cherry picked from commit e3393e6304)
2026-05-06 12:29:11 -04:00
Frank Praznik
68082c7d15 wayland: Unconditionally send an exposure event on window shown status
Some compositors send the frame callback as part of the initial configuration sequence, so the window may already be past the "waiting for frame" state. Ensure that the exposure event is always sent.

(cherry picked from commit 1ac0ae9224)
2026-05-05 18:33:14 -04:00
Anonymous Maarten
d34a306ea9 cmake/sdlcpu: detect mips
PlayStation Portable uses MIPS32

(cherry picked from commit 8effeecb8d)
2026-05-06 00:34:14 +03:00
Evan Hemsley
6b28e6870e GPU: D3D12 stencil plane transition (#15519)
(cherry picked from commit fee8c94b5c)
2026-05-05 12:55:33 -07:00
Frank Praznik
85ebd16fb2 x11: Disable the X Synchronization Extension by default
Under the right conditions, this extension can result is smoother resizing when rendering with OpenGL, however, it is known to cause problems in certain cases, such as when handling presentation externally.

Gate it behind a hint, and disable it by default. Developers can selectively enable it when they verify that they meet the criteria for using it, and that it behaves correctly in their apps/games.

(cherry picked from commit b8545fce54)
2026-05-05 13:51:41 -04:00
Sam Lantinga
05d8af1a75 Fixed rare cursor corruption on Windows
If the cursor was created with a temporary surface that was pointing at external memory, then when the cursor is used it might be referencing memory that had already been freed.

(cherry picked from commit f6f4664ed1)
2026-05-05 08:55:45 -07:00
Ryan C. Gordon
6d35168a63 thread: Remove semaphore in thread creation.
This was added so that the new thread definitely has its threadid set, via
SDL_GetCurrentThreadID(), before SDL_CreatThread returns, but this broke
Emscripten, which can't wait on a newly-created thread, since the thread won't
start until a later mainloop iteration.

Now we have the creating thread set this id in SDL_SYS_CreateThread, where
platform-specific logic can figure out how to calculate the new thread's ID
from the parent thread, without using SDL_GetCurrentThreadID().

Fixes #15509.

(cherry picked from commit 922b872b4f)
2026-05-05 00:54:08 -04:00
Nintorch
3013f975ac Fix JoyCon mappings on Android
(cherry picked from commit 3c1636a958)
2026-05-04 11:49:45 -07:00
Nintorch
52b6bceedf Add support for joystick motion sensors on Android
(cherry picked from commit c699512adc)
2026-05-03 15:11:59 -07:00
Frank Praznik
5c107908ff wayland: Pass the inverted flag for horizontal scroll events
Natural scrolling affects both axes, and the compositor may not send the vertical axis orientation if the frame has no vertical scroll motion, so purely horizontal events need to be flagged as inverted as well.

(cherry picked from commit 3ee0439ae5)
2026-05-03 17:45:46 -04:00
Nintorch
c239edd6e0 Fix Xbox controller names in MFI joystick backend (#15499)
controller.vendorName returns a generic name for Xbox controllers ("Controller"), so we have to give them proper names.

(cherry picked from commit c805a4d632)
2026-05-03 09:26:38 -07:00
Sam Lantinga
796782fc89 Updated to version 3.4.9 for development 2026-05-01 19:49:54 -07:00
Sam Lantinga
d9d5536704 Updated to version 3.4.8 for release 2026-05-01 17:02:55 -07:00
Sam Lantinga
1d75b6bc59 Fixed crash on Windows when a controller is connected
(cherry picked from commit 4a52a5ee04)
2026-05-01 16:57:47 -07:00
Igor
2dbfe0ead9 X11TK: fix late null-check causing segfault
The code is using `controls.window` before checking if it isn't null.

I found this bug by accident when I tried to run `SDL_ShowSimpleMessageBox`.

It first tried using Wayland with `zenity`, but since I don't have `zenity`, it fallbacked to `X11_ShowMessageBoxImpl`.

For some reason it couldn't create a window, maybe something related to XWayland, so `controls.window` was `NULL`.

(cherry picked from commit e70f1bfc29)
2026-05-01 19:13:54 -04:00
Sam Lantinga
be6f1b74dc Updated to version 3.4.7 for development 2026-05-01 06:43:01 -07:00
Sam Lantinga
3aabb7bc53 Updated to version 3.4.6 for release 2026-05-01 06:31:29 -07:00
Cameron Gutman
102bf22db8 haptic: Enable gamepad haptic support under sdl2-compat
(cherry picked from commit c677c913a6)
2026-04-30 21:17:56 -07:00
Sam Lantinga
65eda5fbd4 Fixed copyright on SDL_hidapi_steam_triton.c
Fixes https://github.com/libsdl-org/SDL/issues/15486
Closes https://github.com/libsdl-org/SDL/pull/15487

(cherry picked from commit e9a6d7eda0)
2026-04-30 19:56:07 -07:00
Cameron Gutman
ed70ce85c1 pen: Fix enabling touch emulation while a pen is connected
(cherry picked from commit 41f079491a)
2026-04-29 19:50:48 -05:00
Jakub Wasilewski
cc150bc566 metal: Added missing lock in METAL_INTERNAL_PerformPendingDestroys.
Without this lock, a concurrent call to SDL_ReleaseGPUBuffer, SDL_ReleaseGPUTransferBuffer or SDL_ReleaseGPUTexture can cause one of the arrays to be reallocated while METAL_INTERNAL_PerformPendingDestroys is iterating over it, causing a bad day all around.

(cherry picked from commit 1492911c7d)
2026-04-29 08:48:49 -07:00
Cameron Gutman
46f87cdc5a pen: Only create touch emulation device when a pen is present
(cherry picked from commit 1aa72247af)
2026-04-29 02:21:46 -04:00
Sam Lantinga
d7af22f927 Disable accidentally enabled debug logging
(cherry picked from commit e1e6cbe6ec)
2026-04-28 17:26:48 -07:00
Ryan C. Gordon
fbd792e4df android: Parsing the APK's central dir is separate from the AAssetManager.
Only parse when necessary, which it isn't when opening a file, so this is now
separated from creating the cached AAssetManager object.

(cherry picked from commit 9235ac4efd)
2026-04-28 20:25:19 -04:00
Ryan C. Gordon
79dacf6630 android: Use enough zip64 format info to see APKs with files that are > 4gb.
(cherry picked from commit 40e60452ad)
2026-04-28 20:25:10 -04:00
Ryan C. Gordon
46045ea060 android: Parse the APK directory tree, replace AAssetManager enum/getpathinfo.
The AAssetManager won't supply this information to us, but it's just a zip
file, so we can read its central directory ourselves. We can still use
AAssetManager for file i/o to the APK's assets, so we don't have to deal with
compression and other zipfile features.

Fixes #15220.
Reference Issue #15347.

(cherry picked from commit bb4332bdc2)
2026-04-28 20:25:05 -04:00
Sam Lantinga
3164b74256 Don't use the fake HID endpoint for Xbox controllers on Windows
(cherry picked from commit d5fca9628a)
2026-04-28 14:10:29 -07:00
Ryan C. Gordon
affc61cc5e checkkeys: Sleeping for 100ms every frame makes the program too unresponsive.
Makes it feel like there's a bug in SDL's text input handling. 10ms is fine.

(cherry picked from commit 7212ab1c2a)
2026-04-28 17:16:37 +03:00
Cameron Gutman
0013e9e1d3 atomic: Fix and cleanup SDL_UnlockSpinlock()
- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove MSVC x86/x64 case which is now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking

(cherry picked from commit 95ae0c194e)
2026-04-27 19:42:39 -05:00
Cameron Gutman
22b5ceb0c7 atomic: Fix infinite recursion in SDL_CompilerBarrier() fallback
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.

(cherry picked from commit 66e98b5598)
2026-04-27 14:31:09 -04:00
Sam Lantinga
259e4fe1a2 Fixed double-backspace with hardware keyboard on iOS
(cherry picked from commit b7726026f8)
2026-04-27 10:55:11 -07:00
Sam Lantinga
aef5dc0967 Use SDL_SendScreenKeyboardShown() and SDL_SendScreenKeyboardHidden() on iOS
We now have events for on-screen keyboard visibility, so we should use these instead of starting and stopping text input.

Fixes https://github.com/libsdl-org/SDL/issues/15437
Confirmed not to regress the fix in https://github.com/libsdl-org/SDL/pull/11845

(cherry picked from commit dcf05165d3)
2026-04-27 10:55:11 -07:00
Sam Lantinga
d83ac9ebfc testime: use the correct properties when enabling text input
(cherry picked from commit 6f952a8e63)
2026-04-27 10:55:11 -07:00
Frank Praznik
2a53eed783 renderer: Check the surface validity flag when re-acquiring the surface in the software renderer
If a size change occurs, the sdl2-compat event handler will flush the renderer, which will cause the software renderer to re-acquire a surface that was invalidated due to the size change. However, if the OnWindowPixelSizeChanged handler is called afterward, the invalid flag will be set on the surface, causing presentation to fail.

Check both for a null surface pointer and an invalid surface flag when checking surface validity in the software renderer.

(cherry picked from commit 73fc274ef7)
2026-04-27 12:57:40 -04:00
Cameron Gutman
c784127077 atomic: Use __atomic_signal_fence() for SDL_CompilerBarrier()
This is the (slightly) more standard way to accomplish it.

(cherry picked from commit d5acd7f123)
2026-04-26 22:04:58 -05:00
ShulkerSakura
1d228f8a7d Add keychron Q3 blacklist (#15462)
(cherry picked from commit 543a05bf08)
2026-04-26 07:45:43 -07:00
Sam Lantinga
ee2bebbace Fixed keyboard being hidden while being shown on Android
(cherry picked from commit 47d14491a6)
2026-04-25 17:11:14 -07:00
Ryan C. Gordon
33f4093086 haiku: Don't strdup SDL_GetError()'s string before using it in SDL_SetError().
This isn't necessary anymore, after recent fixes.

(cherry picked from commit 8fb1c6e367)
2026-04-25 15:27:15 -04:00
Ryan C. Gordon
8975782d9a error: Alternate between two buffers in SDL_SetError.
This way you can always safely use SDL_GetError() in your formatted string:

```c
SDL_SetError("Couldn't open '%s': %s", filename, SDL_GetError());
```

This problem was hidden on platforms that use the dynamic API, because it
would format the new error string to a separate buffer first, to deal with
the varargs entry point.

Fixes #15456.

(cherry picked from commit 559d226fc6)
2026-04-25 15:18:25 -04:00
Anonymous Maarten
74058d40d6 cmake: also check iconv on Windows when SDL_SYSTEM_ICONV is defined
(cherry picked from commit 929e304b18)
2026-04-25 20:50:45 +03:00
Sam Lantinga
70d4363890 Ignore the first hover event with a stale position on iOS
Fixes https://github.com/libsdl-org/SDL/issues/15450

(cherry picked from commit 3c02de2f7c)
2026-04-25 07:26:25 -07:00
Cameron Gutman
396cd2d7f7 atomic: Fix memory barriers on MSVC ARM64
(cherry picked from commit 2c4c8172d7)
2026-04-24 20:13:22 -05:00
Cameron Gutman
604a4dfa69 atomic: Use acquire/release InterlockedExchange intrinsics on ARM64EC
(cherry picked from commit 0220a41a2e)
2026-04-24 19:01:31 -05:00
Cameron Cawley
da0e3abd41 Fix compiler warning in MSVC ARM64 builds
(cherry picked from commit fa68a73788)
2026-04-24 19:01:31 -05:00
Sam Lantinga
eebe7558d5 Fixed the menu controller button state on recent Apple platforms
The OS reports the button state as of macOS 11.0, iOS 14.0, and tvOS 14.0, so use that instead of the deprecated pause handler.

(cherry picked from commit 1146ea484a)
2026-04-24 11:38:13 -07:00
Frank Praznik
d240da419e wayland: Avoid excessive exposure events during interactive resizes
Only send the unblocking exposure event once per frame, so that clients using an event watcher won't redraw excessively.

Also ensure that the unblocking exposure is always sent on the libdecor path.

(cherry picked from commit 01a7588f8e)
2026-04-24 13:26:18 -04:00
Sam Lantinga
b00d32c10a Don't do name blacklisting if there's no name
(cherry picked from commit c124da4367)
2026-04-24 07:34:54 -07:00
Sam Lantinga
89eb50b25e Fixed crash in SDL_startswith() when passed NULL strings
Fixes https://github.com/libsdl-org/SDL/issues/15451

(cherry picked from commit f3d7df54e2)
2026-04-24 07:34:54 -07:00
Petar Popovic
8f99954e01 SDL_EnumerateDirectory(""): Don't append path separator if path is empty
(cherry picked from commit 1db6d5381a)
2026-04-23 22:53:16 -04:00
Cameron Gutman
da032b77ab atomic: Use DMB ISHLD for aarch64 acquire barrier
This is a little more efficient than a DMB ISH and matches what
GCC, Clang, and MSVC generate for a C++11 acquire fence.

(cherry picked from commit f2206974b0)
2026-04-23 21:19:29 -05:00
Cameron Gutman
ef425def66 atomic: Use __atomic_thread_fence() when available
This avoids requiring inline assembly for each architecture.

It also fixes some weakly ordered architectures which lacked
said inline assembly (RISC-V, MIPS, LoongArch, etc) and were
thus disasterously broken.

(cherry picked from commit 2858a32723)
2026-04-23 18:53:28 -05:00
Anders Jenbo
525842f2e7 Prefer higher color depths in SDL_GetClosestFullscreenDisplayMode()
(cherry picked from commit 9fa9edeadb)
2026-04-23 15:33:43 -07:00
Sam Lantinga
88102f8d3c Revert "(video) fix SDL_GetClosestFullscreenDisplayMode aspect ratio & refresh rate picking logic"
This reverts commit 0231ff03de.

This causes SDL to return 1024x768 when asking for a best fit to 640x480 (thanks @AJenbo), so I'm reverting this until we can investigate more.

(cherry picked from commit 7b23cd62ca)
2026-04-23 13:23:56 -07:00
Semphris
5454711c3b Update Zenity dialog filters to ignore case
(cherry picked from commit 726e82d0f3)
2026-04-21 14:39:26 -07:00
Nintorch
563b8cb51c Include OS detection in Emscripten joystick GUID
This PR modifies the Emscripten joystick backend to detect the user's OS and store its ID in the GUID, because different OSes might need different mappings for the same controllers.
I'm not sure if different browsers on the same OS can also have different mappings, but if they can, browser detection can be added to the GUID too if needed.

This PR also makes the GUID use `SDL_HARDWARE_BUS_USB` instead of `SDL_HARDWARE_BUS_UNKNOWN`, similarly to how Android and MFI backends always use `SDL_HARDWARE_BUS_BLUETOOTH` and GameInput, XInput, and RawInput backends always use `SDL_HARDWARE_BUS_USB`.

(cherry picked from commit 60a59fa557)
2026-04-21 10:35:52 -07:00
Frank Praznik
7060088ffc dialog: Use case-insensitive filter matching on portal dialogs
On most implementations, filter pattern matching is case-sensitive. For case-insensitive matching of a pattern such as '*.png', the pattern *.[pP][nN][gG]' must be used.

(cherry picked from commit 387439d009)
2026-04-21 11:42:22 -04:00
Nintorch
9cdad39b52 Add trigger rumble support to Emscripten joysticks
This PR adds trigger rumble support to the Emscripten joystick backend.

(cherry picked from commit 651136ac7a)
2026-04-21 07:46:16 -07:00
Petar Popovic
7bd84b29e9 Fix potential leak in camera example
(cherry picked from commit eacfe835e7)
2026-04-21 07:40:16 -04:00
som3a-dev
ab6bc13ef1 (video) fix SDL_GetClosestFullscreenDisplayMode aspect ratio & refresh rate picking logic
(cherry picked from commit 0231ff03de)
2026-04-20 10:51:53 -07:00
Frank Praznik
462b1f7b0d dbus: Return false if the screensaver inhibitor interface is unavailable
Returning true with an unavailable interface in no-op cases can prevent fallback to other inhibition methods. If the inhibitor interface was previously tried and marked as unavailable, just return false.

(cherry picked from commit 125ed508c2)
2026-04-20 12:59:01 -04:00
atiradonet
7ca97d0791 joystick: Add VIRPIL Controls flight stick and throttle device IDs. (#15418)
VIRPIL Controls (VID 0x3344) flight sticks are misclassified as
gamepads by SDL's axis-count heuristic because they report exactly
6 axes, matching SDL_GAMEPAD_AXIS_COUNT. Adding them to the
appropriate device lists ensures correct classification.

Tested on Linux (Fedora 43, kernel 6.19) with:
- R-VPC Stick MT-50CM3 (PID 0x4391) -> SDL_JOYSTICK_TYPE_FLIGHT_STICK
- L-VPC Stick MT-50CM3 (PID 0x8390) -> SDL_JOYSTICK_TYPE_FLIGHT_STICK
- VPC VMAX Prime Throttle (PID 0x0196) -> SDL_JOYSTICK_TYPE_THROTTLE

(cherry picked from commit 3b89c7b537)
2026-04-20 09:04:42 -07:00
Frank Praznik
c819960a1c hints: Correct the cursor DPI scaling hint
Support for this hint was removed from Wayland shortly after it was added, but the documentation was never updated to reflect this.

(cherry picked from commit 76aa12701a)
2026-04-20 10:33:39 -04:00
Frank Praznik
aadc6724d8 wayland: Fix scaled cursor image selection
When the pointer isn't being scaled, make sure the cursor scale factor is set to that of the window to avoid blurry cursors on high-DPI desktops, and use the inverse of the pointer scale value when selecting buffers for size-adjusted cursors. Fixes a regression from adjusting custom cursor sizes when using scale to display mode, and ensures that the best buffer size for the scaled cursor is always selected.

(cherry picked from commit 03f1a84302)
2026-04-20 10:21:53 -04:00
Cameron Cawley
447ba0aa01 Improve constness with Clipboard APIs
(cherry picked from commit 43c928ee86)
2026-04-19 07:06:43 -04:00
Cameron Gutman
97c154791b atomic: Fix missing full memory barrier on GCC/Clang
__sync_lock_test_and_set() is designed for creating locks, not as
a general atomic exchange function. As a result, it only provides
an acquire memory barrier and isn't guaranteed to actually store
the provided value (though it does on architectures we care about).

__atomic_exchange_n() is supported on GCC/Clang for the last ~10
years, so let's use that instead if available. We will keep the
__sync_lock_test_and_set() fallback around for ancient platforms,
but add a full memory barrier to match the documented behavior.

(cherry picked from commit 509a36db16)
2026-04-19 06:55:12 -04:00
William Horvath
350f873534 windowsrawinput: Add missing WIN_SetRawKeyboardFlag_Inputsink stub.
(cherry picked from commit 00f9a25879)
2026-04-17 14:48:05 -04:00
Ryan C. Gordon
0e105ba49f CLAUDE.md: Just copy the text from AGENTS.md in here for now.
Someone mentioned that Claude sees this file's previous text and adds "look at
AGENTS.md" to it's TODO list instead of treating it as the thing it should do
first.

If everything decides to prefer AGENTS.md at some point, we'll delete this
file.

A symlink would apparently also work, but it would be the only symlink in the
SDL git repo, so it seemed less disruptive to just copy the file over for now.

(cherry picked from commit 847fc72b1b)
2026-04-16 13:55:51 -04:00
Ryan C. Gordon
0f67a2d179 CLAUDE.md: added.
Apparently Claude Code won't read AGENTS.md by default at this moment, but
since that's the direction we're moving, let's just add the file Claude
currently looks for and tell it that the actual instructions are in AGENTS.md.

I thought these things were supposed to be less complicated that interacting
with humans, lol.

(cherry picked from commit 1124e44e4c)
2026-04-16 12:22:42 -04:00
Frank Praznik
3dc844148c wayland: Fix some comments
Fix grammar, and remove a TODO that is no longer relevant with an event thread.

(cherry picked from commit c1bf0e9de9)
2026-04-16 10:15:26 -04:00
Ryan C. Gordon
95965bfef4 AGENTS.md: Change "may not" to "must not".
(Hat tip to Sean Barrett on the stronger wording here.)

(cherry picked from commit 5bda0ccfb0)
2026-04-15 17:27:40 -04:00
Ryan C. Gordon
533ca2ea0c policy: Clarify that "AI" means specific things.
(cherry picked from commit 954e2f3354)
2026-04-15 15:42:08 -04:00
Ryan C. Gordon
2e90ed4290 policy: Updated AI-related text based on excellent feedback.
(cherry picked from commit 4711119605)
2026-04-15 15:42:02 -04:00
Ryan C. Gordon
00c3cfcf97 policy: Added to the PR template, and an AGENTS.md, refusing AI contributions.
Fixes #15350.

(cherry picked from commit 08285d828e)
2026-04-15 15:41:56 -04:00
Ryan C. Gordon
a727925b5a wikiheaders: Don't escape . chars in manpage's brief section.
Otherwise, the `apropos` command gets upset.

Fixes #15387.

(cherry picked from commit a49a5e87a9)
2026-04-15 13:31:42 -04:00
David Vanderson
d6f7b314b3 xinput2: correct horizontal touchpad scrolling direction
This fixes testmouse so when fingers move left the green line moves
left.

(cherry picked from commit 5e0f721fd4)
2026-04-13 19:44:58 -04:00
Frank Praznik
88acac053a wayland: Enable text input even when the text input protocol is not available.
Even without the text input protocol, basic text can still be obtained from individual keys and the composition system.

(cherry picked from commit dd6d49afbd)
2026-04-12 13:03:29 -04:00
Mathieu Eyraud
69d4499c56 Don't call function pointer when it is NULL
(cherry picked from commit dc16a35140)
2026-04-10 10:54:08 -07:00
Cameron Gutman
e54cc2b1fb kmsdrm: Fix order of GBM and EGL teardown
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.

(cherry picked from commit 463b6be133)
2026-04-10 10:38:43 -07:00
Frank Praznik
e057712565 x11: Ignore slave button presses on non-focused windows
When a window has the pointer grabbed, the X server will grab all master device events, and XInput2 will continue to deliver slave events to the window immediately under the pointer, regardless of grab status. Only send slave pointer events to the focused window, and fall back to the core X events to catch button presses missed when the pointer is over another window.

(cherry picked from commit 0fc9db9b82)
2026-04-10 12:51:56 -04:00
Sylvain
3243ae52e7 Android: fix lint warning "unneed cast to Activity"
(cherry picked from commit ccf688c921)
2026-04-10 07:09:02 -07:00
Cameron Gutman
2d0ea900ba kmsdrm: Fix double-free of GBM surface buffer in atomic mode
(cherry picked from commit c2d0b59f29)
2026-04-10 00:06:49 -05:00
Sam Lantinga
61ba96db36 Don't send any commands to the GPU while hidden
Previously we weren't doing drawing, but we were enqueuing viewport commands and so forth, which were causing GPU permission errors on iOS. We really don't want to be sending any work to the GPU when we're in the background.

(cherry picked from commit 57f3d2ea0a)
2026-04-08 10:10:00 -07:00
Sam Lantinga
a22488663c Fixed SDL_GlobDirectory() on asset paths on Android
Make sure we pass the original path back to the directory enumeration callback.

(cherry picked from commit 5c430f8715)
2026-04-08 09:10:54 -07:00
Sam Lantinga
d2289755e9 Fixed crash if SDL_SYS_CreateThread() fails (thanks @capehill!)
Fixes https://github.com/libsdl-org/SDL/issues/15340

(cherry picked from commit 7f23f09ee8)
2026-04-07 12:23:14 -07:00
Ozkan Sezer
7f3071a207 SDL_hidapi_zuiki.c: silence bogus -Warray-bounds warnings from gcc-4.9
(cherry picked from commit f61a22e10f)
2026-04-07 06:47:02 +03:00
Frank Praznik
ff2c970c15 dbus: Better handle local URI paths
Decode file URIs before trying to open them, and properly handle non-URI local paths.

(cherry picked from commit b8e8caf7c5)
2026-04-06 19:45:12 -04:00
Anonymous Maarten
6b73386987 ci: bump workflows
(cherry picked from commit 928cfef4b7)
2026-04-07 01:27:56 +02:00
cosmonaut
543b8b9b12 GPU: Fix Vulkan backend segfault
(cherry picked from commit f8b7e22d7d)
2026-04-06 14:47:00 -07:00
cosmonaut
c226a67760 GPU: Fix memory leak in Vulkan command buffer
(cherry picked from commit aeb4309c0e)
2026-04-06 10:40:14 -07:00
Frank Praznik
33090dc318 dbus: Use OpenFile for opening local 'file://' URIs
Per the spec, OpenURI can't open local paths, so OpenFile needs to be used instead.

(cherry picked from commit 0a54fdb862)
2026-04-06 11:45:37 -04:00
Sascha Reuter
3939fb03bf GPU Vulkan: handle VK_ERROR_SURFACE_LOST_KHR in acquire path
On Android, backgrounding and foregrounding an app causes the Vulkan
surface to be destroyed. vkAcquireNextImageKHR returns
VK_ERROR_SURFACE_LOST_KHR, but the acquire while(true) loop only calls
RecreateSwapchain which doesn't recreate the surface, resulting in an
infinite retry loop and a black screen.

Handle VK_ERROR_SURFACE_LOST_KHR by setting both needsSurfaceRecreate
and needsSwapchainRecreate, then returning to let the existing
recreation path handle it on the next call.

Fixes #15322

(cherry picked from commit c98b36ff03)
2026-04-06 07:19:36 -07:00
Frank Praznik
d07bd49a7d misc: Use the OpenURI D-Bus portal for opening URLs
This works inside of containers, and supports passing an activation token with the request, which is needed on Wayland to transfer focus to the browser.

(cherry picked from commit 682da4ee98)
2026-04-05 16:33:11 -04:00
Peter Kokot
4bc27ad15e CMake: Replace CMAKE_COMPILER_IS_GNUCC with CMAKE_C_COMPILER_ID
CMAKE_COMPILER_IS_GNUCC is obsolete variable and can be replaced with
CMAKE_C_COMPILER_ID (also available since early CMake versions).

In the past CMake versions also LCC and QCC compilers had this varible
set to boolean true but these aren't relevant here.

(cherry picked from commit 25aa1c643f)
2026-04-04 10:29:06 -07:00
Sam Lantinga
ce3cc80aca Send SDL_EVENT_SCREEN_KEYBOARD_HIDDEN when the keyboard is hidden on Android
(cherry picked from commit fc2f4fcc22)
2026-04-04 10:08:57 -07:00
Sam Lantinga
103a4c4cb2 Enable npot texture wrapping if GL_OES_texture_npot is available
(cherry picked from commit 173adc1bf6)
2026-04-04 08:17:57 -07:00
Sam Lantinga
b6fd088246 Updated to version 3.4.5 for development 2026-04-03 17:16:53 -07:00
Sam Lantinga
5848e584a1 Updated to version 3.4.4 for release 2026-04-03 16:10:59 -07:00
Sam Lantinga
a883e69d7b Use the correct index for PS2 controllers
Closes https://github.com/libsdl-org/SDL/pull/15294

(cherry picked from commit 41c3a91079)
2026-04-03 16:08:55 -07:00
Sanjay Govind
8d7f469fb5 Add support for GIP guitars via gameinput (#15301)
(cherry picked from commit 7f86f9107d)
2026-04-03 16:03:17 -07:00
foxtacles
18463ccb8f (emscripten) Add null checks for gamepad in vendor/product/xinput helpers (#15313)
navigator.getGamepads() can return null for a slot if the gamepad
disconnects between the gamepadconnected event and the proxied
MAIN_THREAD_EM_ASM_INT call. This causes a TypeError when accessing
gamepad.id. Add null guards matching the pattern already used in
EMSCRIPTEN_JoystickOpen and EMSCRIPTEN_JoystickRumble.

(cherry picked from commit 59602fb473)
2026-04-03 15:08:37 -07:00
Frank Praznik
2798ac07ea wayland: Retrieve the system minimum libdecor limits before overwriting them 2026-04-03 14:08:58 -04:00
Sam Lantinga
9403c6b43d Use the correct source rectangle when doing scaled blits
Fixes https://github.com/libsdl-org/SDL/issues/15309

(cherry picked from commit 5ae1308e5b)
2026-04-03 01:33:21 -07:00
nilFinx
48060320f6 haiku: Always assume that the URL is encoded (required on nightly) (#15305)
(cherry picked from commit f3a3b4b95a)
2026-04-03 00:01:41 -07:00
Cameron Gutman
f3e1c93ea2 kmsdrm: Add missing KMSDRM_FBFromBO() failure check
(cherry picked from commit 1674a04b01)
2026-04-02 22:03:43 -05:00
Christian Semmler
5be888591c emscripten: Fix navigator.getGamepads crash in worker threads
The three EM_JS functions (SDL_GetEmscriptenJoystickVendor,
SDL_GetEmscriptenJoystickProduct, SDL_IsEmscriptenJoystickXInput)
call navigator.getGamepads() which is only available on the main
browser thread. With PROXY_TO_PTHREAD, the joystick callbacks are
dispatched to a worker where the Gamepad API is not available,
causing a TypeError.

Convert these from EM_JS to static functions using
MAIN_THREAD_EM_ASM_INT, which proxies the JavaScript execution to
the main browser thread. This matches the pattern already used by
other navigator.getGamepads() calls in the same file.

(cherry picked from commit be8643f739)
2026-04-02 19:37:33 -07:00
Cameron Gutman
c391e73432 kmsdrm: Initialize kms_in_fence_fd to -1
Prior to this fix, we closed stdin on the first call to drm_atomic_commit().

(cherry picked from commit 3c11b43e59)
2026-04-02 20:47:51 -05:00
Ryan C. Gordon
195b58121e kmsdrm: Disable atomic mouse code for now.
The rest of the atomic codepath is still enabled and usable.

This fixes missing and weird mouse cursors. We'll debug this code later on.

Reference Issue #15242.

(cherry picked from commit f423a2ae34)
2026-04-02 20:41:54 -04:00
Sanjay Govind
b264c19c83 Update to GameInput V3 (#15302)
(cherry picked from commit c58a61fdd4)
2026-04-02 17:10:59 -07:00
Sam Lantinga
870c006288 Don't strip the alpha channel when scaling surfaces if it will be needed
Fixes https://github.com/libsdl-org/SDL/issues/15297

(cherry picked from commit 501ee05129)
2026-04-02 11:01:27 -07:00
Ryan C. Gordon
9c6876ac18 pipewire: Don't mark a device disconnected if pw_stream_dequeue_buffer fails.
Apparently this _can_ happen under load, or maybe some other weird condition.

Hopefully this will encourage PipeWire to fire output_callback again, and
we'll just try again later.

Reference Issue #14916.

(cherry picked from commit 32ef82caaf)
2026-04-02 13:59:43 -04:00
Sam Lantinga
31c7aab5db Added a hint "SDL_SURFACE_MALLOC" to disable aligned surface allocation
This is needed for sdl12-compat, where all surfaces were not aligned.

(cherry picked from commit 156187bf58)
2026-04-02 10:33:24 -07:00
Janne Virtala
212f7539cb SDL_PrivateJoystickForceRecentering(): fix infinite loop
(cherry picked from commit b5ef75249f)
2026-04-02 09:28:15 -07:00
Ryan C. Gordon
2503d34724 aaudio: Respect SDL_HINT_AUDIO_DEVICE_STREAM_ROLE hint.
Fixes #15299.

(cherry picked from commit 4d17b99d0a)
2026-04-02 11:25:22 -04:00
Sam Lantinga
b7e1f88db8 Added documentation to fix building on macOS with Xcode 12.2 (thanks @buhman!)
Fixes https://github.com/libsdl-org/SDL/issues/15167

(cherry picked from commit 6466c10ae4)
2026-04-01 16:38:12 -07:00
Petar Popovic
8af454a0a1 SDL_GlobDirectory(): Don't descend into sub-directories, if not requested by pattern
(cherry picked from commit d6129d063f)
2026-03-30 16:39:14 -04:00
Ryan C. Gordon
270c2b8e86 process: Don't duplicate NULL stdio handles on Windows.
It's okay to pass null handles to win32's CreateProcess().

Fixes #14977.

(cherry picked from commit f13cd9a666)
2026-03-30 16:28:41 -04:00
Sam Lantinga
3c9510f2ce Fix msvc analyzer warnings
- Initialize some out variables that are annotated inout in the function setting them.

- Fix 'dwVerHandle' might not be '0' warning from msvc analyzer calling GetFileVersionInfoA. MSDN says that
  the lpdwHandle param to GetFileVersionInfoSize is optional (set to zero) and the dwHandle param to
  GetFileVersionInfoA is ignored. msvc goes a step further and explicitly warns if dwHandle is not provably 0.

Fixes the following:
SDL3\src\stdlib\SDL_string.c(2359): warning C6054: String 'text' might not be zero-terminated.
SDL3\src\video\windows\SDL_windowsevents.c(897): warning C6001: Using uninitialized memory 'devName'.
SDL3\src\video\windows\SDL_windowskeyboard.c(644): warning C6388: 'dwVerHandle' might not be '0':  this does not adhere to the specification for the function 'GetFileVersionInfoA'.

(cherry picked from commit b878ab1691)
2026-03-30 10:49:46 -07:00
zn-arf
3ae089e4de Fix Metal GPU backend not being included in CMake configuration
Fixes #15285

Missing Metal GPU block in CMakeLists.txt prevents `HAVE_SDL_GPU` from being set when only Metal is enabled.

(cherry picked from commit e66f1b5162)
2026-03-30 10:49:46 -07:00
Ryan C. Gordon
2b6bee46b2 thread: SDL_CreateThread() shouldn't return before the new thread is set up.
Fixes #15290.

(cherry picked from commit 0756603e6d)
2026-03-30 10:40:16 -04:00
Sam Lantinga
be45038432 Make sure native textures have the same channel precision if possible
Fixes https://github.com/libsdl-org/SDL/issues/14882

(cherry picked from commit fdfcfc0566)
2026-03-30 06:40:51 -07:00
Ryan C. Gordon
1fc5001f77 emscripten: Add support for automounting persistent storage before SDL_main.
Now apps can have persistent files available during SDL_main()/SDL_AppInit()
and don't have to mess with Emscripten-specific code to prepare the filesystem
for use.

(cherry picked from commit dcc177faa4)
2026-03-29 07:41:37 -07:00
Semphris
c546c5d335 Fix Windows file dialog calling the callback twice
If the modern implementation of file dialogs on Windows fails, it will invoke the callback on error and report an error, then SDL would attempt invoking the dialog again using an older implementation, which would call the callback again.

This is not desired behavior, so it has been changed as follows:
- If the modern dialog fails before showing (missing library/symbol), don't call the callback and try the older dialogs in case we're on an old platform.
- If the dialog fails while or after showing, assume the error is a normal invocation error (such as an invalid path), call the callback and don't show the older dialogs to prevent showing two dialogs in succession to the user.

(cherry picked from commit a54dd7ba45)
2026-03-29 02:06:59 -04:00
Ryan C. Gordon
880739f587 stdlib: Patched SDL_rand_f to compile on pre-C99 compilers.
Visual Studio _still_ doesn't report itself as C99 compatible, afaict, but
does support the syntax as of VS2017 15.6, apparently.

This page mentions the first version of Visual Studio that handles hexidecimal
float notation:

https://stackoverflow.com/questions/18180116/vc-rejecting-hexadecimal-floating-point-constant?utm_source=chatgpt.com

If not Visual Studio, we also take the messier path for things that don't
report themselves as C99. Most things will take the cleaner path, though.

Closes #15276.

(cherry picked from commit a157d96de8)
2026-03-28 14:45:53 -04:00
Frank Praznik
5a7e2d41b8 x11: Look for text/uri-list in the list of MIME types more thoroughly
A uri-list of files is the preferred format, so don't bail if a preferred text format is encountered first.

(cherry picked from commit 1df279a04f)
2026-03-27 12:22:34 -04:00
Sam Lantinga
69cf2cf6aa Added documentation for getting the full resolution in iOS
(cherry picked from commit 995d4e10a6)
2026-03-27 08:44:07 -07:00
Strultz
b11ac0087f Fix window caption drawing on borderless windows (#15275)
(cherry picked from commit 6a9449c098)
2026-03-27 05:14:46 -07:00
c4veman
a004c1bcc4 Check Windows version before setting window attributes
(cherry picked from commit 159bba9aa1)
2026-03-26 10:44:05 -07:00
Petar Popovic
db3ff5f5c4 SDL_SetWindowShape(): Remove shape when argument is NULL
(cherry picked from commit 53c799a7a9)
2026-03-26 10:42:46 -07:00
Regan Green
764d7633ea Use DSBFREQUENCY_MAX instead of hardcoded constant for DirectSound driver max frequency.
(cherry picked from commit 1d2f9f0e0e)
2026-03-25 17:42:58 -07:00
Clownacy
fda7c0b461 Fix DirectSound buffer creation failure with >200kHz
Caps the sample rate at 200kHz so that SDL's mixer will downsample any streams which are higher than that.

My Mega Drive emulator outputs at 223721Hz (the sample rate of the PSG chip), and `SDL_OpenAudioDeviceStream` fails due to DirectSound's `CreateSoundBuffer` returning an 'invalid parameter' error code. Lowering the sample rate makes the error go away.

Reported to me by @B3HKO in this issue:
https://github.com/Clownacy/clownmdemu-frontend/issues/60

The 200kHz limit is documented here:
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee419022(v=vs.85)

DirectSound's Wikipedia article mentions that problems may occur with sample rates above 192kHz, but no source is provided, so I am unsure whether to take it seriously.

(cherry picked from commit 6efe0e19a7)
2026-03-25 13:24:03 -07:00
Anonymous Maarten
add51f85c2 ci: clang-tools-extra is no longer available for mingw32
mingw32 and mingw64 are in the process of being deprecated

(cherry picked from commit be6f1efa26)
2026-03-25 18:57:33 +01:00
c4veman
eca1479ff5 Fix endmacro syntax in macros.cmake
(cherry picked from commit 8eeef53a80)
2026-03-25 08:31:21 -07:00
nmlgc
c4af41ba27 render: Skip UV check when software-rendering untextured quads
Fixes a crash when calling SDL_RenderGeometryRaw() with both `texture`
and `uv` set to `NULL`, and with geometry that is laid out in a way
that passes the quad checks.

(cherry picked from commit 989de77f4f)
2026-03-25 07:25:23 -07:00
Green Sky
4b8fcb468b video: add more direct mjpeg to yuv conversions
(cherry picked from commit 998159fa95)
2026-03-24 09:00:43 -07:00
Sam Lantinga
99a026cfde Clarified SDL_MostSignificantBitIndex32() documentation
Fixes https://github.com/libsdl-org/SDL/issues/15247

(cherry picked from commit f22e088211)
2026-03-22 17:52:54 -07:00
Sam Lantinga
fa68d7de8b Updated documentation on customizing your Android app name
(cherry picked from commit a48dee5ac1)
2026-03-21 16:04:09 -07:00
Sam Lantinga
b7e46361f5 Fixed incorrect sampler when changing Metal draw state
(cherry picked from commit 0f9292a367)
2026-03-21 14:09:19 -07:00
sunshineinabox
c9271b2f18 egl: Handle error when binding EGL API in context creation
(cherry picked from commit 6b060435e3)
2026-03-20 12:28:14 -04:00
Konstantin Tomashevich
7b7322b222 SDL_systhread.c: Remove SIGCHLD from blocked signal mask.
When SIGCHLD is blocked, some executables (for example CMake) do not exit properly when executed using `SDL_CreateProcess` from any SDL thread (not main thread). `SDL_CreateProcessWithProperties` docs say that `SIGCHILD` should not be ignored or handled, therefore blocking it during thread creation is a likely reason for the bug. Should fix #15210.

Signed-off-by: Konstantin Tomashevich <konstantin.tomashevich@gmail.com>
(cherry picked from commit 291d1b6491)
2026-03-18 13:10:45 -07:00
Frank Praznik
a4c326a7bb x11: More XInput2 #define cleanups
Fixes building on very old XInput2 versions (pre-2012) without smooth scrolling and multitouch.

(cherry picked from commit 62af66f14a)
2026-03-18 11:26:34 -04:00
Frank Praznik
a2fb4d6d47 x11: Fix building when XInput2 is not available
(cherry picked from commit d88f76caac)
2026-03-17 15:32:26 -04:00
Frank Praznik
b560f8ab17 wayland: Scale custom cursors with the pointer scale
When emulating display modes or using display scaling, custom cursors need to be scaled, or they can appear too large or small relative to the window size.

(cherry picked from commit 3d21b3bc68)
2026-03-17 13:28:27 -04:00
Steel
0bf2065922 Add support for PXN VD6 Wheelbase
(cherry picked from commit 32cf5fe93d)
2026-03-16 10:51:30 -07:00
Cameron Gutman
5ee57a9da1 windows: Fix Print Screen key capture during keyboard grab
(cherry picked from commit 5f92aac095)
2026-03-15 15:35:00 -05:00
Sam Lantinga
86c664d695 Fixed error when SDL_LoadSurface_IO() is passed a NULL src
(cherry picked from commit 1d081314a8)
2026-03-15 13:17:22 -07:00
Sam Lantinga
8fa310e162 Add a necessary step for iOS app setup in Xcode
(cherry picked from commit 46f35e6ea2)
2026-03-15 01:55:07 -07:00
Frank Praznik
4dc440ff71 wayland: Eliminate redundant keyboard and mouse removals
The SDL keyboard and mouse will be removed when destroying the seat, so there is no need to preemptively remove them.

(cherry picked from commit 566448d95a)
2026-03-13 22:43:25 -04:00
Rachel Blackman
8ba903c859 Add second-gen Backbone One to recognized controllers.
(cherry picked from commit ba00e772a7)
2026-03-13 15:40:29 -07:00
Ryan C. Gordon
a63fd07812 io: With stdio, only forbid opening directories as files.
This allows opening Unix device nodes, etc.

Fixes #15188.

(cherry picked from commit 9f19cffc78)
2026-03-12 13:17:08 -04:00
Ryan C. Gordon
993993aaf3 io: Wrap IsRegularFileOrPipe in a more generic preprocessor test.
This way we can turn it off for various console platforms without changes
to this file.

(cherry picked from commit 4d675f2bd3)
2026-03-12 13:17:02 -04:00
Ryan C. Gordon
c189cce819 io: Remove iodata->regular_file check.
It wasn't used, and causes an extra fstat().

(cherry picked from commit 803cd7589a)
2026-03-12 13:16:58 -04:00
Sam Lantinga
6248eeec09 Disable system gesture state for all GCControllers
Technically we only want to do this for controllers that are opened, but we don't have a way to match up controllers using other APIs with individual GCControllers.

(cherry picked from commit 11adfd2008)
2026-03-12 08:43:19 -07:00
Frank Praznik
58c9c0ba7b wayland: Prevent the window from errantly growing when scale to display is used
Some compositors will send a configure event immediately after a scale event, however, this event can contain the old logical size, and should be ignored, or the window will incorrectly change size when moved between displays with differing scale factors.

Store the last requested logical size as the last configure size when resizing a floating window due to a scale change, so a configure event immediately following with the old size will be ignored.

(cherry picked from commit 18219d5b53)
2026-03-12 10:23:39 -04:00
Evan Hemsley
96c4104523 GPU: Refcount Vulkan allocations to fix transfer corruption on defrag (#15127) 2026-03-11 10:31:01 -07:00
WillyJL
e8f600bf46 Fix strpbrk() discarded const qualifier
(cherry picked from commit c45be94938)
2026-03-10 14:25:39 -07:00
Nintorch
ffd2696516 Fallback for non-gamepad controllers in GameInput
This PR makes the GameInput joystick backend ignore non-gamepad controllers if DirectInput or XInput backends are enabled. This is done to prevent possible bugs and/or regressions.

(cherry picked from commit 419dcfe747)
2026-03-10 11:06:37 -07:00
Ryan C. Gordon
c5bc4576fc video: Default SDL_GL_FRAMEBUFFER_SRGB_CAPABLE back to zero.
(This was corrected in main, but there isn't a clean cherry-pick we can do for
the release-3.4.x branch at this point, since various pieces of the sRGB work
made it in here in a different order, but this is the one crucial line that
appears to be missing.)

Reference Issue #14898.
2026-03-09 16:47:49 -04:00
Nintorch
66020c2ed7 Small GameInput joystick backend improvements
This PR includes small improvements to the GameInput joystick backend:
- Device subtypes
- Compatibility with DirectInput joystick mappings (if the controller is not a gamepad, i.e. `GAMEINPUT_InternalIsGamepad()` returns `false`)
- Fallback to DirectInput/XInput for currently unsupported devices (force feedback ones and the ones that are neither gamepads nor controllers, I'm not sure if that's possible, but maybe racing wheels and other device subtypes would count?)

(cherry picked from commit 0138843eb7)
2026-03-09 11:12:30 -07:00
Mike Egger
c2a910ab02 windows: support flag RIDEV_INPUTSINK in raw input (#15182)
(cherry picked from commit ae3ae4ba44)
2026-03-08 16:12:03 -07:00
Ozkan Sezer
1e4fd21700 stb_image: Fix -Wdouble-promotion warning
Upstream PR 1902 by Björn Wahlstrand at https://github.com/nothings/stb

(cherry picked from commit 31aa18fc1d)
2026-03-09 00:40:14 +03:00
Sanjay Govind
36ed4b75d1 support batteries on 3rd party controllers
(cherry picked from commit e610b85d1c)
2026-03-08 11:40:56 -07:00
Petar Popovic
7280152549 SDL_InternalGlobDirectory(): set string length of base directory to 1, if it's just one slash
(cherry picked from commit 67ac0e5eee)
2026-03-08 11:39:11 -07:00
Petar Popovic
a70353891e SDL_InternalGlobDirectory(): keep track of pathlen and reuse it, instead of calling SDL_strlen(path)
(cherry picked from commit 93e3e8a5fe)
2026-03-08 11:39:11 -07:00
Petar Popovic
fb312b2463 SDL_GlobDirectory(): Don't chop off first slash from path, if it's just multiple slashes
(cherry picked from commit 961a04fa26)
2026-03-08 11:39:11 -07:00
Sanjay Govind
b08f7924a4 Add support for whammy and tilt on PS4/5 guitars
PS4/5 controllers put device specific data into a specific region in the report, so we have to extract it separately.

No known guitars use the right stick on the guitar, so to keep things working similarly to PS3, i have opted to map whammy and tilt the same way as the PS3 rb guitars.

(cherry picked from commit 94f17d6c61)
2026-03-08 11:36:17 -07:00
Ethan Lee
96e05da95e gpu: Fix swapchain texture cycling.
This is actually a 1:1 copy of a patch we wrote for GPU PS5 some time ago!
2026-03-07 10:37:53 -05:00
Ethan Lee
776e87ada9 Revert "render: Added Xbox DXIL for gpu backend".
Turns out Xbox is okay with the PC DXIL, it just isn't as optimal without the root signature annotations.

This reverts commit f2c4c66429.
2026-03-04 15:52:52 -05:00
ImpDi
99a65853a6 Texture2DArray and Compute Pipeline in DirectX12 (#15161)
Apparently, because PlaneSlice wasn't initialized, we couldn't use SDL_GPU_TEXTURETYPE_2D_ARRAY and SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE together, as the error d3d12:
"ID3D12Device::CreateUnorderedAccessView occurred: The PlaneSlice -858993460 is invalid when the resource format is R8G8B8A8_UNORM and the view format is R8G8B8A8_UNORM. Only Plane Slice 0 is valid when creating a view on a non-planar format. [ STATE_CREATION ERROR #344: CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE]"

(cherry picked from commit 89cab56536)
2026-03-03 19:20:09 -08:00
Tobiasz Laskowski
4128c4e44b Fix backspace on android with api 30+
(cherry picked from commit 01bd8b3780)
2026-03-03 17:12:28 -08:00
Frank Praznik
18a0157457 Deprecate SDL_INIT_EVERYTHING from SDL2
Adds SDL_INIT_EVERYTHING to the deprecated symbol list, and renames an internal usage to avoid a warning.

(cherry picked from commit e7199cad0b)
2026-03-03 15:10:43 -05:00
Frank Praznik
b36a5ab6f4 Log failure reasons during early X11 and Wayland initialization
Log the reason for failure during initialization to the debug log to aid in troubleshooting.

(cherry picked from commit 5880b8a283)
2026-03-03 13:33:11 -05:00
Frank Praznik
aa5bcfa3d8 wayland: Don't add keys with the super/GUI modifier to the keymap
SDL normalizes the super/GUI modifier away, so adding a key with this modifier will overwrite the base, unmodified value.

(cherry picked from commit 8c8efd4ccd)
2026-03-02 18:30:40 -05:00
Qiu Qiang
ef03c66ef3 camera: Fix crash when setting frame rate and improve FPS precision
- Use exact numerator/denominator from spec for CMTime to avoid rounding errors.
- Wrap frame rate setting in @try-catch to prevent crashes on strict drivers.

(cherry picked from commit e2a2e2c31e)
2026-03-02 12:00:32 -08:00
DominusExult
6299705584 Use AV capture methods available since iOS 7
(cherry picked from commit 0270da4d1f)
2026-03-02 12:00:29 -08:00
MSRPP-dev
fcce05a19c Update SDL_render_sw.c
Fix the bug in the standard scaling path, SDL_RENDERCMD_COPY should follow the same pattern as SW_RenderCopyEx.

(cherry picked from commit 4dbf5811e9)
2026-03-02 09:49:59 -08:00
Sanjay Govind
1ee158cd31 fix off by one with tilt on ps3 guitars (#15144)
(cherry picked from commit 34378609bb)
2026-03-02 09:45:54 -08:00
Antonio Lattanzio
e4c664a75f oldnames: Add missing deprecated SDL2 symbol mappings (#15137)
(cherry picked from commit 4c52cfb495)
2026-03-02 09:44:52 -08:00
Sam Lantinga
7a1d02083d Added surface validation to SDL_DuplicateSurface()
(cherry picked from commit 73b13728de)
2026-03-02 09:42:01 -08:00
Ethan Lee
0030fafda2 render: Added Xbox DXIL for gpu backend 2026-03-01 23:27:37 -05:00
Ethan Lee
c9479f86f6 testgdk: Update icon filename for the new png image 2026-03-01 23:27:22 -05:00
Petar Popovic
8bf6e23164 Fix potential memory leak in VULKAN_AcquireCommandBuffer() on error
(cherry picked from commit 77f4a8e2b8)
2026-03-01 14:11:19 -08:00
Petar Popovic
fb9bb7426d Fix memory leak when X11 toolkit window locale SDL_strdup() fails
(cherry picked from commit fb1d1ab306)
2026-03-01 11:44:59 -08:00
Sam Lantinga
3a2a13d966 Loading PNG files are part of the core SDL library
Don't disable this functionality when defining SDL_LEAN_AND_MEAN, but if you need to, you can define SDL_DISABLE_STB if you want to compile this out.

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

(cherry picked from commit 72d5fe213f)
2026-03-01 11:44:01 -08:00
Petar Popovic
48fb914228 Fix potential memory leak in SDL_HIDAPI_HapticOpenFromJoystick() on error
(cherry picked from commit 6cf03ca729)
2026-03-01 11:36:14 -08:00
Sam Lantinga
3e87c31a6c Added surface validation to SDL_ConvertSurfaceRect()
Fixes https://github.com/libsdl-org/SDL/issues/15141

(cherry picked from commit 2d9fca46c6)
2026-03-01 11:35:11 -08:00
Sam Lantinga
654f6f94f6 Fixed SDL_GetIOSize() return value
Fixes https://github.com/libsdl-org/SDL/issues/15129

(cherry picked from commit 0a1c7b5348)
2026-02-28 08:42:21 -08:00
SDL Wiki Bot
e7e2805475 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit 5212b82c4f)
2026-02-26 07:55:56 +03:00
SDL Wiki Bot
df72790cfb Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit 2e18cf8d09)
2026-02-26 07:55:40 +03:00
Sam Lantinga
0f02c41ac0 Note that SDL_getenv() is case sensitive
Fixes https://github.com/libsdl-org/SDL/issues/15086

(cherry picked from commit 21e10b2e76)
2026-02-26 07:55:20 +03:00
zuiki_inn
6d93ffe923 Add ZUIKI EVOTOP controller support with gyroscope and accelerometer sensor capabilities. (#15034)
(cherry picked from commit 29ca920fdf)
2026-02-25 20:24:50 -08:00
rabbit-ecl
2fad85fa26 Use Uint64 instead for tick_numerators in USE_128BIT_MATH
(cherry picked from commit 230814e85e)
2026-02-25 20:19:30 -08:00
Sam Lantinga
36ba09b63d Fixed definition of builtin function '_m_prefetch'
Fixes https://github.com/libsdl-org/SDL/issues/15116

(cherry picked from commit 5340d6a94c)
2026-02-25 14:30:12 -08:00
Sam Lantinga
b0414440a3 Fixed timer overflow on some platforms
We have an implementation that uses 128-bit math and one that handles large values without it (thanks @jessechounard and @rabbit-ecl!)

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

(cherry picked from commit 24404d9047)
2026-02-25 11:43:08 -08:00
SDL Wiki Bot
28014a0452 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit 0246598d62)
2026-02-25 07:40:51 -08:00
SDL Wiki Bot
488e196415 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit 03fcc037d9)
2026-02-25 07:40:51 -08:00
Ethan Lee
d5b90fd82f render: Reduce scope of D3D12 GDK event watcher to Xbox
(cherry picked from commit a4cd62ef93)
2026-02-25 07:40:51 -08:00
SDL Wiki Bot
c903079708 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit bad072e693)
2026-02-25 07:40:51 -08:00
Ethan Lee
b488c2e4a0 gdk: Render/GPU can call SuspendX, document when to call SuspendComplete
(cherry picked from commit 5770e013c2)
2026-02-25 07:40:51 -08:00
Sam Lantinga
aa9de89232 Added battery status for newer FlyDigi controllers
(cherry picked from commit 49a8b4229b)
2026-02-24 20:50:11 -08:00
Sanjay Govind
645b8e7f6d Support accelerometers on 3rd party ps3 controllers (#15109)
(cherry picked from commit 0c859452ef)
2026-02-24 19:00:11 -08:00
Sanjay Govind
17532fd62e Set joystick_type for known ps3/wii instruments (#15111)
(cherry picked from commit a7ccd48957)
2026-02-24 17:30:07 -08:00
Sanjay Govind
2214522b69 deal with controllers that don't have report ids
(cherry picked from commit 1419bcb6cb)
2026-02-24 15:19:49 -08:00
Frank Praznik
c608ce5acb x11: Also send key releases when reconciling state
(cherry picked from commit 2f38b6a396)
2026-02-24 17:13:04 -05:00
Sanjay Govind
b3adee0720 Fix up controller types for various playstation and wii instruments (#15104)
(cherry picked from commit 0e4008441f)
2026-02-24 13:36:08 -08:00
Sam Lantinga
00c85a0b9e Added support for the Flydigi Vader 5 Pro in Xbox 360 mode
(cherry picked from commit 2385dc6297)
2026-02-24 10:20:29 -08:00
Brenton Bostick
77edb4d5d3 fix unknown argument nBufSize
(cherry picked from commit c259f969f2)
2026-02-24 09:50:34 -08:00
Brenton Bostick
62aea530b4 fix JNI parameter types
(cherry picked from commit 0d0db08b61)
2026-02-24 09:49:57 -08:00
Brenton Bostick
abab2f1181 make sure #endif comment matches the macro name
(cherry picked from commit a5889b0e44)
2026-02-24 09:49:08 -08:00
Void Star Caster
01d8bb5b7c Fix GetSampler() bug for INDEX8 pixel format (#15099)
(cherry picked from commit 4a4ae4a79d)
2026-02-24 08:06:44 -08:00
Vicki Pfau
27439467ce camera: Don't try to fake entire range for FRMIVAL_TYPE_CONTINUOUS
V4L2 is able to advertise that a video device is able to display any frame
interval within a continuous range. SDL does not allow advertising this and
only exposes discrete frame intervals. To work around this, SDL attempted to
generate a subset of the range with a fixed interval. Unfortunately, the way
this was accomplish is inherently broken and led to attempting to allocate a
very large number of formats per resolution and colorspace. With the Magewell
Pro Capture HDMI, which can expose FRMSIZE_TYPE_CONTINUOUS as well, this can
expose a truly astronomical number of formats, exceeding 1 PB of RAM. This will
lead to an OOM kill for any process that tries to initialize the camera
subsystem.

This patch just tests to see if some common frame rates are within the
contiuous range and expose those. SDL still does not handle
FRMSIZE_TYPE_CONTINUOUS in a graceful way so it still uses over a gigabyte of
RAM for each possible combination of sizes, but with this patch it no longer
leads to an OOM kill. The API will need amending for proper support for both
continuous frame sizes and frame intervals.

(cherry picked from commit ab6dd970ac)
2026-02-24 06:55:10 -08:00
Vicki Pfau
399b2b18ce Support SL/SR on Switch 2 controllers, but only in mini-controller mode
It doesn't really make sense to support these in combined mode since they're usually occluded.

(cherry picked from commit 8a1684fbbc)
2026-02-24 06:53:41 -08:00
Frank Praznik
cbee4abdfc x11: Don't send duplicate key down events when reconciling
Modifier keys shouldn't be repeated.

(cherry picked from commit 550394eecd)
2026-02-23 15:10:17 -05:00
Sam Lantinga
7066c6491e Fixed cursor mask padding calculation
(cherry picked from commit 2e4ac09b1f)
2026-02-23 09:53:12 -08:00
Sam Lantinga
74bfc913ac Improved support for byte array pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/15082

(cherry picked from commit 4f06087b36)
2026-02-21 12:52:12 -08:00
Ozkan Sezer
d01ec84d85 headers: selected sdl-wiki-bot-authored updates from main branch
to eliminate discrepancies between release-3.4.x and main branches.

(cherry picked from commit 165bfd3e83)
(cherry picked from commit 90aaa23977)
(cherry picked from commit 7d27ca282e)
(cherry picked from commit 6fc31b7f0b)
(cherry picked from commit c71c53c406)
(cherry picked from commit c9b7ca0c42)
(cherry picked from commit e2bc4be482)
(cherry picked from commit ae4fb50316)
(cherry picked from commit 6f45f97af0)
(cherry picked from commit d2ca570050)
(cherry picked from commit 73500019ea)
(cherry picked from commit 72ed7d0f87)
(cherry picked from commit 2aacf018f0)

[ci skip]
2026-02-21 03:03:32 +03:00
Sam Lantinga
d281a080c6 Updated to version 3.4.3 for development 2026-02-20 15:59:20 -08:00
Sam Lantinga
683181b47c Updated to version 3.4.2 for release 2026-02-20 15:12:29 -08:00
Alex Threlfo
a3bfd36665 filesystem: Fix Android asset enumeration
Passes expected relative paths to Android's AssetManager API instead of
absolute ones + fixes some indexing logic with trailing slashes.
2026-02-20 15:09:53 -08:00
Ryan C. Gordon
70e1804e9f docs: Clarify symlink info in SDL_GetPathInfo, etc.
Fixes #15078.

(cherry picked from commit 69ddf1d6c7)
2026-02-20 14:30:39 -05:00
Anonymous Maarten
eaa20b5e8a ci: add CFLAGS to pkg-config link command
(cherry picked from commit bc211aa150)
2026-02-20 11:20:57 -08:00
Ethan Lee
a056d0f39a cocoa: Don't include KHR_portability_enumeration by default.
This is only useful if the application knows to add the flag introduced by this
extension, and at that point the application can also include the extension
themselves.

Case in point: SDL_gpu_vulkan was already doing this!
2026-02-20 11:35:43 -05:00
Ethan Lee
910d31e56a vulkan: Only enable KHR_portability_enumeration when available 2026-02-20 11:35:37 -05:00
Ryan C. Gordon
77dd2685ec include: More \threadsafety documentation.
Reference Issue #7140.

(cherry picked from commit 1223767b2c)
2026-02-20 10:46:17 -05:00
Ryan C. Gordon
7cc9955ae1 emscripten: Move some EM_ASM blocks to MAIN_THREAD_EM_ASM.
These blocks reference the `navigator` global, which is not available in
background threads.

(cherry picked from commit c728e2f044)
2026-02-20 10:28:12 -05:00
Jesse Chounard
76ff74eeab Fix D3D12 DSV creation for array/cube/cube-array depth textures
DSV creation was missing a TEXTURE2DARRAY branch for array, cube, and
cube-array depth textures. It fell through to TEXTURE2D, so
FirstArraySlice was never set and all layers' DSVs targeted layer 0.
This caused incorrect rendering when using depth textures with multiple
layers, such as cubemap shadow maps.
2026-02-20 10:26:32 -05:00
Ryan C. Gordon
dc590257ba n3ds: SDL_SYS_GetPreferredLocales now handles error cases correctly.
Previously it would have reported success but not returned a valid string, and
didn't check for the (probably extremely unlikely) case of overflowing our
locale list array.

(cherry picked from commit 3aa531000a)
2026-02-20 10:14:36 -05:00
Frank Praznik
267f13446d video: Check video backend initialization when querying the grabbed window
SDL_GetGrabbedWindow() can be called when the video system is uninitialized, and, since there is no window parameter, _this must be checked for validity to avoid a segfault.

(cherry picked from commit be82f316c4)
2026-02-19 11:22:55 -05:00
Ryan C. Gordon
4cc96e3506 include: Added \threadsafety notes to about 60 more functions.
Reference Issue #7140.

(cherry picked from commit 28e4269915)
2026-02-18 19:51:25 -05:00
Ryan C. Gordon
13ff9e0818 filesystem: Fix SDL_GlobDirectory on iOS and Android.
It SDL_SYS_EnumerateDirectory was changing the path string and passing it to
the callback, causing chaos in the glob handler, which expected the original
string to pass through.

Fixes #15057.

(cherry picked from commit a3b0403412)
2026-02-18 08:21:48 -08:00
Ryan C. Gordon
42abf69434 emscripten: Fix only one mouse button being usable at a time.
Fixes #15056.

(cherry picked from commit c9591c515c)
2026-02-17 19:05:18 -05:00
Ryan C. Gordon
5d9d966d59 emscripten: Allow resize events on fullscreen windows.
Fixes browsers on phone that change screen orientation during fullscreen not
getting a resize event.

Fixes #15024.

(cherry picked from commit 0f2d415dee)
2026-02-17 18:41:38 -05:00
William Horvath
8df04368b3 gpu_vulkan: Set texture container before transitioning to default barrier state.
Avoids a null dereference of currentRegion->vulkanTexture->container in DefragmentMemory:

} else if (!currentRegion->isBuffer && !currentRegion->vulkanTexture->markedForDestroy) {
...
&currentRegion->vulkanTexture->container->header.info
... (among others)

by not "VULKAN_Submit"ting (and thus adding it to the defrag pool) before setting the container.

Although rare (defrag almost never ran), this crash happened in a real-world application.

(cherry picked from commit 06bf8d1924)
2026-02-17 14:13:03 -08:00
Sam Lantinga
3b4cf41c92 Fixed HIDAPI PS5 Bluetooth report format
(cherry picked from commit 129627068f)
2026-02-17 08:57:28 -08:00
Zack Middleton
65dfdce3df win32: Set error for SDL_GL_GetSwapInterval()
(cherry picked from commit 54de246b4b)
2026-02-17 10:27:45 -05:00
Ryan C. Gordon
3a5d0bac71 Revert "MacOS: improve scroll smoothing"
This reverts commit 5dab2c73f0.

We'll revisit this in the next SDL release.

Reference Issue #15058.

(cherry picked from commit 63c0650321)
2026-02-17 10:25:04 -05:00
Cameron Gutman
29c58245a7 android: Fix scancode for AKEYCODE_CHANNEL_DOWN
(cherry picked from commit f0bda7b655)
2026-02-17 00:27:18 -06:00
Sam Lantinga
1edb906aad Fixed detection of the "Android TV Box" as a TV
(cherry picked from commit 1dcc6e2135)
2026-02-16 12:35:34 -08:00
Sam Lantinga
1faaa128e5 Treat the D-pad center button as SDL_SCANCODE_RETURN
This fixes handling of the Android TV remote select button sent over CEC.

(cherry picked from commit 089f5e1318)
2026-02-16 12:35:34 -08:00
Sam Lantinga
99e1d9595f Moved mouse/keyboard detection to a separate thread on Windows
Getting device names can hang for a long time on certain devices, so make sure this is done on a separate thread to avoid blocking initialization and the main loop.

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

(cherry picked from commit bc623d1af6)
2026-02-16 11:27:11 -08:00
Sam Lantinga
8389de757a Don't re-query HID device vendor and product
(cherry picked from commit a98e49409e)
2026-02-16 11:27:11 -08:00
Sam Lantinga
a82660bb76 Added temporary workaround hint "SDL_WINDOWS_DETECT_DEVICE_HOTPLUG"
Some devices with broken drivers hang when their name is queried, so added a workaround for applications that don't need input device details. The long term fix is to move the hotplug detection into a separate thread.

(cherry picked from commit a66988621a)
2026-02-16 11:27:11 -08:00
Ryan C. Gordon
3d2af85934 examples: Make source code and console tabs take 80% of browser page.
Fixes #14997.
2026-02-16 13:17:55 -05:00
Ryan C. Gordon
ea2b4f4674 hints: Rename SDL_HINT_OPENGL_FORCE_SRGB_CAPABLE.
It's now SDL_HINT_OPENGL_FORCE_SRGB_FRAMEBUFFER, since it does more than mess
with the srgb-capable context attribute now.

Reference Issue #14898.

(cherry picked from commit 10b524c7cc)
2026-02-16 13:09:24 -05:00
Ryan C. Gordon
febe5dd3bc render: opengl and opengles2 renderers try to disable GL_FRAMEBUFFER_SRGB.
Reference Issue #14898.

(cherry picked from commit fc570a1a1c)
2026-02-16 13:09:18 -05:00
Ryan C. Gordon
8f9dd75ead video: Only set GL_FRAMEBUFFER_SRGB state if the hint requests it.
Reference Issue #14898.

(cherry picked from commit ead67481c0)
2026-02-16 13:08:59 -05:00
Cameron Gutman
a849c4d361 win32: Fix composition UI being displayed when IME is disabled
(cherry picked from commit 8535936401)
2026-02-16 09:00:49 -08:00
NateXS
8973dfd9cc n3ds: Don't put audio thread in system core on Old 3DS systems
(cherry picked from commit 149abe8f85)
2026-02-16 08:44:52 -08:00
Sam Lantinga
2f4919c6ff Use 20 ms as the default audio buffer size on Android
It turns out that Android will not pick a low latency buffer size by default.

(cherry picked from commit c381b2bdfa)
2026-02-13 14:35:25 -08:00
DominusExult
d390a4e8f0 Fix testime to pass window coordinates to SDL_SetTextInputArea().
Also moved the area closer to the bottom so the panning of the screen can be observed on Android and iOS.

(cherry picked from commit e049fff360)
2026-02-13 08:23:03 -08:00
Sam Lantinga
9f0ebbef46 Steam Controller report 0x45 is used for BLE mode
(cherry picked from commit 0b1c592fda)
2026-02-12 15:46:19 -08:00
Sam Lantinga
6707df6d88 Updated Steam Controller packet handling
(cherry picked from commit 84c21cf970)
2026-02-12 14:34:52 -08:00
Sam Lantinga
744ea5701c Fixed initializing the PowerA OPS v1 Wireless Controller
(cherry picked from commit 4e2fd57e77)
2026-02-11 16:54:42 -08:00
Sam Lantinga
b467276f4a Fixed initializing the PowerA Fusion Pro 4 on Steam Link hardware
(cherry picked from commit 2b484a1ccb)
2026-02-11 16:54:42 -08:00
Sam Lantinga
4361920501 Fixed HIDAPI hotplug detection in applications that don't initialize video
(cherry picked from commit eaeca340f3)
2026-02-11 09:12:35 -08:00
Sam Lantinga
b5cad69b9c Fixed HIDAPI hotplug detection when initializing gamepads off the main thread
(cherry picked from commit d3f9899df5)
2026-02-11 09:03:43 -08:00
Ryan C. Gordon
723b77ede8 wasapi: Patched to compile.
(cherry picked from commit 31404a9dcb)
2026-02-10 11:35:33 -05:00
Sylvain
a7bac75470 Android: prevent SDLActivity and Main Thread to access mJoystick at the
same time. same for mHapticHandler

(cherry picked from commit a35bcad0be)
2026-02-10 07:54:19 -08:00
Ryan C. Gordon
a806a9092b wasapi: stop infinite loop in audio thread when recording device is unplugged. 2026-02-10 09:24:34 -05:00
Ryan C. Gordon
55d78567b1 video: Wrap OpenGL work in ifdefs.
Apparently the rest of SDL_GL_CreateContext compiles on platforms without
OpenGL, though!  :)

(cherry picked from commit 3dc48a4890)
2026-02-09 21:45:42 -05:00
Ryan C. Gordon
88bbc94921 video: Respect SDL_HINT_OPENGL_FORCE_SRGB_CAPABLE with GL_FRAMEBUFFER_SRGB.
Reference Issue #14898.

(cherry picked from commit 9f5747ccd4)
2026-02-09 21:45:22 -05:00
Ryan C. Gordon
027183f89c video: Maybe fix build.
(cherry picked from commit 01689bca0e)
2026-02-09 21:45:10 -05:00
Ryan C. Gordon
0810c5ac0d video: Force GL_FRAMEBUFFER_SRGB state at OpenGL context creation time.
The default varies between OpenGL and OpenGL ES, so try to force it to what
the app actually requested with SDL_GL_FRAMEBUFFER_SRGB_CAPABLE.

Fixes #14898.

(cherry picked from commit 083c6b8872)
2026-02-09 21:45:00 -05:00
Ryan C. Gordon
9f45801fa7 render: OpenGL and GLES2 should explicitly request a not-sRGB-capable context.
Reference Issue #14898.

(cherry picked from commit 60690ff829)
2026-02-09 21:44:47 -05:00
Ryan C. Gordon
ae3bb879c7 emscripten: drag-and-drop fixes.
FS.mkdir() will throw a javascript exception if the scratch directory already
exists, so catch/ignore that.

Wrap the rest of the scratch i/o in a try/catch block; the event will only
send if everything works out.

Wrap some calls from Javascript to the C runtime's free() in an
EMSCRIPTEN_KEEPALIVE function, so that the compiler doesn't optimize the
function out and crash at runtime.

Fixes #14999.

(cherry picked from commit 267e681a0b)
2026-02-09 21:43:12 -05:00
Sam Lantinga
17eb20505c Fix the 8BitDo Ultimate 2D Wireless Controller showing up multiple times
This controller has 3 interfaces, one for the Xbox gamepad protocol, and two HID interfaces. We should only handle the Xbox interface in the Xbox driver.

(cherry picked from commit 9f8c70713a)
2026-02-09 13:29:47 -08:00
Sam Lantinga
badd9e5a15 You can't combine SDL_STRINGIFY_ARG() and SDL_FUNCTION
Removed obsolete documentation that shows this usage and macros that attempt it.

Also allow SDL_FUNCTION to be redefined by the application.

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

(cherry picked from commit 6feb0e1333)
2026-02-08 11:56:12 -08:00
Max Seidenstücker
576c2d2f2c Merge all occurances of __func__ and __FUNCTION__ to SDL_FUNCTION
(cherry picked from commit 8f8880a8eb)
2026-02-08 11:56:12 -08:00
Cameron Gutman
48e5fc7b69 cocoa: Fix 1px border in fullscreen on Tahoe
(cherry picked from commit 1d83a35e48)
2026-02-08 11:01:44 -08:00
Sam Lantinga
12e9ff33c3 Fixed checking against cached shader params (thanks @ccawley2011!)
(cherry picked from commit 4de62c35c0)
2026-02-08 11:00:24 -08:00
William Horvath
054bea938a dummyaudio: Remove bitrotted support for __EMSCRIPTEN_PTHREADS__ code path.
In SDL_audio.c:OpenPhysicalAudioDevice, an attempt is made to SDL_CreateThread
if ProvidesOwnCallbackThread is false, but SDL_CreateThreadWithPropertiesRuntime
is not implemented for Emscripten, so this always fails. I'm not sure if/when
this ever worked, but it simply cannot work in its current state.

(cherry picked from commit 8ee7dc2f9f)
2026-02-08 09:32:18 -08:00
RaceTheMaSe
b9107ec196 dialog_utils: fix NameTransform() function pointer type (#15002)
(cherry picked from commit c15ca27740)
2026-02-08 09:32:18 -08:00
Frank Praznik
5728f9d703 wayland: Check the mod state when sending repeated key text
The control and alt modifiers should suppress text events when repeating to match standard press behavior.

(cherry picked from commit f07ba5b954)
2026-02-07 14:32:12 -05:00
ROllerozxa
e61a874c66 Fix SDL_TriggerBreakpoint being undefined on slimcc
(cherry picked from commit 3919cc902e)
2026-02-07 10:14:28 -08:00
Vicki Pfau
2b72332b81 Fix Switch and Switch 2 player LED patterns
The patterns we were using don't match the official patterns, which fill up as
many lights as players instead of just using the nth player LED. Above 4,
there are some special patterns, as documented on Nintendo's Singaporean site:
https://www.nintendo.com/sg/support/qa/detail/33822

(cherry picked from commit 017d950b6b)
2026-02-07 07:37:51 -08:00
Sam Lantinga
9ee86e7e79 Fixed building with -DSDL_HIDAPI=OFF
Fixes https://github.com/libsdl-org/SDL/issues/14975

(cherry picked from commit 56b77177a9)
2026-02-06 10:00:17 -08:00
Jari Vetoniemi
6168085e45 cocoawindow: fix wrong content scale with ANGLE EGL context
ANGLE expects that the surface layer content scale is updated
accordingly.

<b406401e42/src/libANGLE/renderer/metal/SurfaceMtl.mm (L597-L636)>

(cherry picked from commit ef41e0a0f0)
2026-02-06 09:17:17 -08:00
Wohlstand
000d56702e SDL_render_psp.c: Also apply the similar fix to PSP
Since this problem is the same here

(cherry picked from commit a36ef1f187)
2026-02-06 09:08:58 -08:00
Wohlstand
c12d90108f SDL_render_vita_gxm.c: Fixed the black screen due to zero cliprect
(cherry picked from commit 87a81bd09d)
2026-02-06 09:08:57 -08:00
Wohlstand
44c0feed99 Revert "Reverted Vita cliprect changes"
This reverts commit aeb4b3d2fc.

(cherry picked from commit 75d1d64c75)
2026-02-06 09:08:57 -08:00
Ryan C. Gordon
fc5862b0dd opengl: added SDL_HINT_OPENGL_FORCE_SRGB_CAPABLE.
Reference Issue #14898.

(cherry picked from commit 632c83b722)
2026-02-05 18:45:06 -05:00
Ryan C. Gordon
7f3d51b690 cocoa: Fix SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES=0.
This hint is documented to not just turn off fullscreen windows going into a
new Fullscreen Space, but also to make the green button on a resizeable
window's title bar do a maximize/zoom instead of make the window fullscreen.

Previously, this only did the former and not the latter (or perhaps it worked
and the defaults changed in a newer macOS, we aren't sure).

Fixes #7470.

(cherry picked from commit 50f3adec77)
2026-02-05 18:43:39 -05:00
Vicki Pfau
45086459d2 Add and use libusb_set_auto_detach_kernel_driver for the Switch 2 driver
(cherry picked from commit e1b8ad0380)
2026-02-05 14:59:10 -08:00
Sam Lantinga
5964104910 Guarantee that pens are in proximity before motion and button events
This also delays pen proximity out events to make sure that the pen is really gone before delivering them. On Android, you get a HOVER_EXIT event when the pen contacts the surface, which we don't want to treat as the pen leaving proximity.

(cherry picked from commit bddf6d3e2a)
2026-02-05 14:09:07 -08:00
Sam Lantinga
9194d199e7 Added support for the third stylus button on Android
(cherry picked from commit cd7fc90c87)
2026-02-05 14:09:07 -08:00
Ryan C. Gordon
81d9f30db4 pen: Fixed incorrect comment.
(cherry picked from commit dd18d7ff52)
2026-02-05 14:09:07 -08:00
Sam Lantinga
38b9c9117d Fixed warning: no previous prototype for function 'SDL_PrivateIsGamepadPlatformMatch'
(cherry picked from commit cd14bf3d00)
2026-02-04 14:41:27 -08:00
Frank Praznik
2887de55d6 wayland: Only use owned surface data when processing touches
Otherwise, user data set externally may be treated as SDL window data.

(cherry picked from commit bd472b43f5)
2026-02-04 14:29:08 -05:00
Anonymous Maarten
8107d5b042 cmake: cannot detect deprecated apple-clang link options (they are not fatal)
So skip these

(cherry picked from commit 5f151f4532)
2026-02-03 20:57:32 +01:00
Nintorch
94f6f8d3c3 Add share button mapping to Xbox Series X controller on Android
(cherry picked from commit 997a168e00)
2026-02-03 11:33:44 -08:00
Sam Lantinga
5935fe73d3 Fixed detecting Nintendo Switch Pro 2 controller on Steam Link hardware
In this case, it's available via both libusb and hidraw, but the hidraw device isn't usable. If a device needs to be opened via libusb, don't expose it via hidraw enumeration.

(cherry picked from commit f60231759d)
2026-02-03 10:44:31 -08:00
Anonymous Maarten
775eac98ee surface: verify surface palette in SDL_Save(BMP|PNG) before hitting the FS
(cherry picked from commit 28ea4a8e31)
2026-02-03 09:32:37 -08:00
Ryan C. Gordon
d9bc9dda7a emscripten: Cleanup some wasm32/wasm64 ifdefs.
Fixes #14066.

(cherry picked from commit bb6ced6fc0)
2026-02-02 19:23:33 -05:00
Ryan C. Gordon
f9bb023eeb emscripten: Unify creation of Module['SDL3'] in at SDL_Init time.
(cherry picked from commit 7d093940a7)
2026-02-02 19:23:28 -05:00
Sam Lantinga
9bf533d1c4 Reverted unintended testsprite changes
(cherry picked from commit de605a3b7e)
2026-02-02 16:01:02 -08:00
Sam Lantinga
a2653b857c Fixed the GameCube Controller Adapter showing up twice on macOS
(cherry picked from commit b5206909a7)
2026-02-02 15:56:06 -08:00
Sam Lantinga
00fc74e6af Fixed handling GameCube adapters in PC mode on Linux and macOS
On Windows there is a separate HIDAPI device for each slot. On Linux and macOS, there is a single HIDAPI device and the slot is included in the report.

(cherry picked from commit cdffbdfeaf)
2026-02-02 15:56:05 -08:00
SDL Wiki Bot
28470f9231 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit eb181c8d1a)
2026-02-02 11:40:08 -08:00
Evan Hemsley
171874ae5c GPU: Allow D3D12 backend to load vendored D3D12Core.dll (#14946)
---------

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
(cherry picked from commit e25e0f3c5b)
2026-02-02 11:40:08 -08:00
Anonymous Maarten
6dc3211d56 cmake: dfix disabling dlopen notes when configuring with -DSDL_DLOPEN_NOTES=OFF
(cherry picked from commit b0a9f40e28)
2026-02-01 19:24:19 +01:00
Cameron Gutman
6c38358984 Fix invalidation of bound textures/shaders across a renderer flush on D3D9
(cherry picked from commit 4743f97c39)
2026-01-31 17:17:44 -08:00
Ryan C. Gordon
c3e92cf1c4 asyncio: don't report failures on closing read-only files with Windows IoRing.
We still need the task to go through the IoRing, even though the flush
operation we use to get it there will always fail on a read-only file. So
check for this specific case and don't report failure.

Fixes #14878.

(cherry picked from commit 4df13e8806)
2026-01-31 16:06:54 -08:00
Caleb Cornett
de5e0f1784 GPU: Query UnrestrictedBufferTextureCopyPitchSupported to avoid D3D12 realignment copies
(cherry picked from commit 742a6fd092)
2026-01-31 16:04:03 -08:00
Lucas Murray
1a278bb511 GPU: Fix memory leak when creating D3D12 compute pipelines 2026-01-31 16:24:06 -05:00
Ethan Lee
e803cbb34a gpu: Rank dzn above lavapipe, for WSL Vulkan support 2026-01-31 08:35:04 -05:00
Sam Lantinga
997808a945 Updated SDL_PollEvent() documentation
Fixes https://github.com/libsdl-org/sdlwiki/issues/911

(cherry picked from commit 63a95a4a4d)
2026-01-30 16:24:10 -08:00
Cameron Gutman
3cf15dc222 gamepad: Accept older 'Mac OS X' mappings on macOS
(cherry picked from commit e3c9ec7b67)
2026-01-30 18:12:54 -06:00
Henrique Jorge Barateli
38b5ad824d Fixed PS2 joystick analog sticks not enabled
(cherry picked from commit 8fa8c331a5)
2026-01-30 12:17:39 -08:00
Anonymous Maarten
d90c07a88f cmake: force disable SDL_HIDAPI_LIBUSB when SDL_HIDAPI is disabled
(cherry picked from commit 821ab81a62)
2026-01-30 07:32:38 -08:00
Eddy Jansson
ff2a43bfbf Fix typos in comments.
(cherry picked from commit 23fec649c2)
2026-01-30 07:25:35 -08:00
Ethan Lee
5a4f1cbceb gpu: MSVC buildfix for Vulkan device property struct initialization 2026-01-30 09:41:05 -05:00
Ethan Lee
c4074bc9c9 gpu: Check for Vulkan conformance while checking the device rank.
This should behave largely the same, except now Dozen is given a pass for WSL.

This is a better fix for #14915.
2026-01-30 09:22:13 -05:00
Sam Lantinga
6b6fe286fb Fixed macOS build when video is disabled
Fixes https://github.com/libsdl-org/SDL/issues/14912

(cherry picked from commit 5f0c889082)
2026-01-29 14:30:51 -08:00
Sam Lantinga
e612c58518 Reference count window claim calls for a given GPU device
Fixes https://github.com/libsdl-org/SDL/issues/14918

(cherry picked from commit 696c12826f)
2026-01-29 14:05:13 -08:00
Ethan Lee
dfb270f87c gpu: Vulkan should fail if the best device is non-conformant 2026-01-29 14:42:17 -05:00
Sam Lantinga
1ec73bac92 Fixed typo
(cherry picked from commit 58c30a4451)
2026-01-28 13:43:40 -08:00
Sam Lantinga
e1294f3b48 Fixed the 8BitDo Ultimate 2 Wireless for PC controller showing up twice on macOS
(cherry picked from commit 0f10f81b3b)
2026-01-28 13:39:37 -08:00
Sam Lantinga
9c0b773f09 Fixed memory leak in testffmpeg EGL codepath
Fixes https://github.com/libsdl-org/SDL/issues/14908

(cherry picked from commit ee38b7c3df)
2026-01-28 08:21:11 -08:00
Wouter Wijsman
6cd9374929 Fix PSP_QueueGeometry funcion rendering some textures too small
(cherry picked from commit c1e715439a)
2026-01-28 07:39:43 -08:00
Sam Lantinga
3bde3e2406 Fixed the 8BitDo Ultimate 2 Wireless controller showing up twice on macOS
Fixes https://github.com/libsdl-org/SDL/issues/14902

(cherry picked from commit 3aa3a357fc)
2026-01-27 14:41:36 -08:00
Sam Lantinga
5c002ba0b9 Fixed the NVIDIA SHIELD Controller showing up twice on macOS
Fixes https://github.com/libsdl-org/SDL/issues/14911

(cherry picked from commit 1fe6bf4982)
2026-01-27 13:53:06 -08:00
Sam Lantinga
05fdfa1572 Fixed hang sending output reports to the NVIDIA SHIELD Controller on macOS
(cherry picked from commit 72343b9ee2)
2026-01-27 13:53:06 -08:00
Sam Lantinga
d4da5df088 Fixed unaligned access in NVIDIA SHIELD Controller driver
Also refactored the LOAD16() and LOAD32() macros into SDL_hidapijoystick_c.h

(cherry picked from commit cae2a28f5b)
2026-01-27 13:53:06 -08:00
Sam Lantinga
6fef8fd0dc Fixed Steam Controller battery state
(cherry picked from commit dd53ecbce8)
2026-01-27 09:53:17 -08:00
Nintorch
13f8201dbe Add support for joystick LED for Switch controllers
Co-Authored-By: Thiago Lelles Fernandes <125714191+thilelito@users.noreply.github.com>
(cherry picked from commit 90dabda3b4)
2026-01-27 09:46:00 -08:00
Anonymous Maarten
4431c5f8ba stb_image: use SDL_TARGETING("sse2") macro for supporting intrinsics on 386
(cherry picked from commit ac4f852a6a)
2026-01-25 18:34:33 +01:00
Sam Lantinga
a3232fe84e Set SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN for the GPU renderer
(cherry picked from commit a929eb71b3)
2026-01-25 09:16:01 -08:00
SDL Wiki Bot
2ea3ac2914 Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit 5642fc963e)
2026-01-25 09:16:01 -08:00
Sam Lantinga
34c687a59b Add the type to SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1
(cherry picked from commit 17c375738f)
2026-01-25 09:16:00 -08:00
SDL Wiki Bot
388546be2e Sync SDL3 wiki -> header
[ci skip]

(cherry picked from commit d311b5c779)
2026-01-25 09:16:00 -08:00
Ethan Lee
78b16b3cb8 gpu: Add SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1 property
(cherry picked from commit 16f2037efd)
2026-01-25 09:09:28 -08:00
Madeline Whitmore
e48e8a48ad SDL GPU: Fix features not being enabled with Vulkan 1.1 (#14885)
Use pre-Vulkan 1.2 structs to request features from a Vulkan 1.1 instance.

(cherry picked from commit 97b177c92f)
2026-01-25 08:19:42 -08:00
Eddy Jansson
26352be1e5 More prefer SDL_zero*()
Transform clearing of arrays into SDL_zeroa(), and
clearing through a T* with size(T) into SDL_zerop().

Extends commit 83fb7b6636.

(cherry picked from commit 248223592a)
2026-01-23 16:02:27 -08:00
Eddy Jansson
1d6d424775 Prefer SDL_zero()/SDL_zerop()
Replace uses of 'SDL_memset(E, 0, sizeof(E))' and similar
with the SDL_zero()/SDL_zerop() macros.

(cherry picked from commit 83fb7b6636)
2026-01-23 11:23:55 -08:00
Sam Lantinga
c8fa870b36 Don't load libdecor if SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR is false
Fixes https://github.com/libsdl-org/SDL/issues/14887

(cherry picked from commit fe403220f0)
2026-01-23 11:21:32 -08:00
Frank Praznik
b7df720371 wayland: Don't try to set the seat cursor when no pointer object exists
(cherry picked from commit 79b40ad397)
2026-01-23 09:05:20 -05:00
Sam Lantinga
b73ab6cc82 Revert "cmake: rpi videocore needs brcmegl as well"
This reverts commit cd31381185.

Linking libbrcmEGL.so explicitly breaks (causes segmentation faults) in other code that links and runs the X11 EGL.

Reopens https://github.com/libsdl-org/SDL/issues/14749

At least in my Raspbian Stretch build environment, the vc_dispmanx symbols that were missing are found in libbcm_host.so, which is linked by default.

(cherry picked from commit 7fe30b04bf)
2026-01-22 17:56:35 -08:00
Sam Lantinga
fffa14eb1a Call dbus_message_set_no_reply() when not expecting a reply 2026-01-22 09:42:15 -08:00
Sam Lantinga
5454573e2d Retain the dbus reply when getting string results
The string result points at memory in the reply, so we can't unref that until the string is no longer needed.

Fixes https://github.com/libsdl-org/SDL/issues/14839
2026-01-22 09:42:15 -08:00
Anonymous Maarten
c6489b731e release: synchronize build-scripts/build-release.py
(cherry picked from commit 0f89d64623)
2026-01-21 21:52:07 +01:00
Simon McVittie
b451b27427 dummy: Only initialize evdev input devices in the evdev driver
This avoids some misleading error messages when running unit tests with
the dummy driver: on a typical desktop Linux system, it's normal for
opening keyboards and mouse in `/dev/input/*` to fail with `EACCES`,
and in container technologies that share `/sys` but not `/dev` with the
container, we can find that we fail to open them with `ENOENT`.

Resolves: https://github.com/libsdl-org/SDL/issues/14872
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 9ceb982a63)
2026-01-20 14:17:37 -08:00
Sam Lantinga
895bdc4f21 Fixed divide by zero handling Nintendo Switch 2 controller
(cherry picked from commit b1362f8a42)
2026-01-20 11:04:44 -08:00
Aubrey Hesselgren
9e5975f332 Fix Horipad bluetooth gyro stutter issues using simulated sensor timing approach (based on packet rate observation)
By observation: wired is 250hz/4000ms, and bluetooth is 120hz/8333ms for IMU sensor.

(cherry picked from commit 5c15d74394)
2026-01-19 15:26:03 -08:00
Thour
a84cde99b7 Fix incorrect type in SDL_GetMice() and SDL_GetKeyboards() allocation (#14870)
(cherry picked from commit 124c5922aa)
2026-01-19 15:24:37 -08:00
Wolf3s
aae4cb8d15 Fix the video size matching the renderer.
(cherry picked from commit 0d845e8689)
2026-01-19 10:12:48 -08:00
Brad Smith
8ed4f46db0 cmake: Replace sys/types.h usage with stdint.h with CheckUSBHID
(cherry picked from commit d4d66e77cc)
2026-01-18 16:18:38 -08:00
Brad Smith
3a54ca75cf cmake: Fix header detection with CheckUSBHID
Make use of check_include_files to be able to also include
stdint.h when checking for the headers. Fixes detection of
usbhid.h on OpenBSD.

/usr/include/usbhid.h:40:2: error: unknown type name 'uint32_t'
   40 |         uint32_t _usage_page;
      |         ^

(cherry picked from commit 410a35fbee)
2026-01-18 10:30:09 -08:00
Sam Lantinga
3ec7fc8f59 SDL_CreateGPURenderState() doesn't modify the createinfo parameter
(cherry picked from commit 3f0e0975d8)
2026-01-17 20:49:04 -08:00
ROllerozxa
4214001b97 Fix SDL_SetWindowIcon on singlethreaded Emscripten builds (#14850)
(cherry picked from commit 064096bf61)
2026-01-17 20:39:15 -08:00
Frank Praznik
44b59db1d5 event: Only consider topmost windows when generating SDL_QUIT
Otherwise, the quit event can be sent prematurely. The topmost status must be queried and cached before sending the close request event, as the window may be destroyed in an event handler.

(cherry picked from commit 34b620c3f8)
2026-01-17 15:52:35 -05:00
Frank Praznik
7627f5d838 wayland: Only destroy tool frame callbacks if the cursor is the one being destroyed
(cherry picked from commit 202fdb2795)
2026-01-16 12:31:30 -05:00
ocelote_ml
9c69084ed3 updated png texture example
the example was updated to use png's but they didn't update the error message nor the comments

(cherry picked from commit 008aa18810)
2026-01-16 12:24:30 -05:00
Frank Praznik
3b4ea10ebc wayland: Also check tools for cursor usage during cursor destruction
(cherry picked from commit 35a80bdf1f)
2026-01-16 11:40:08 -05:00
Frank Praznik
799d2ca80b wayland: Don't clear the cursor on leave events
Stop the frame callback and flag the cursor for a refresh when the pointer re-enters the surface, but don't set a null cursor, as it may have already been set after entering a surface that is part of the window decorations, resulting in an unwanted invisible cursor.

(cherry picked from commit 5e2977709b)
2026-01-16 11:40:08 -05:00
William Horvath
66a8454f2d thread: Use a flexible array member for "array" in SDL_TLSData.
Avoids UBSan warning (among other similar ones in SDL_thread.c):
src/thread/SDL_thread.c:109:13: runtime error: index 1 out of bounds for type 'struct (unnamed struct at src/thread/SDL_thread_c.h:70:5)[1]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/thread/SDL_thread.c:109:13

(cherry picked from commit f9395a766f)
2026-01-16 08:32:27 -08:00
Frank Praznik
012443729d events: Raise keyboard keys before sending the focus lost message
Otherwise, the key raises may end up being ignored.

(cherry picked from commit e62d6a95b9)
2026-01-15 15:03:10 -05:00
Cameron Cawley
26d20d5e22 Fix touch screen display IDs on the 3DS
(cherry picked from commit 02c9f2045b)
2026-01-14 15:07:10 -08:00
Sam Lantinga
45ab4a16a2 You can't change the size of a window while in macOS fullscreen space
(cherry picked from commit 77290f9788)
2026-01-14 15:06:45 -08:00
Frank Praznik
2a6187aa6b tests: Don't try to load unsupported image types in testclipboard
Requesting certain MIME types (e.g. EPS formats offered by KDE) can be *very* slow, on the order of multiple seconds, due to requiring significant processing. Only try to load image MIME types that SDL is known to support (BMP and PNG).

(cherry picked from commit 32747ceb84)
2026-01-14 11:01:31 -05:00
Frank Praznik
b7a241973a wayland: Increase the read timeout when reading from SDL_GetClipboardData()
The default timeout value of 14ms is ideal when querying clipboard data while polling events, to prevent excessive lag if the source takes a long time to respond, however, when reading from SDL_GetClipboardData(), the timeout can be too short if a large amount of data must be processed or transferred. SDL_GetClipboardData() is not called while polling events, so using a longer read timeout to greatly increase the chance of success is acceptable.

Use a 5 second timeout when reading from SDL_GetClipboardData() and GetPrimarySelectionText() to greatly increase the chances of a successful read, even if the requested format requires heavy processing.

(cherry picked from commit 2a0d04613c)
2026-01-14 11:01:30 -05:00
Sam Lantinga
b8aff4a3ed Revert "Fix duplicate event dispatch in Cocoa event pump"
This reverts commit dd52dd8995.

After that commit mouse input is not received and the window cannot be closed or resized.

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

(cherry picked from commit 206989a22d)
2026-01-13 16:24:59 -08:00
Sam Lantinga
d264c27468 Added support for the Razer Raiju V5 Pro in wireless mode
(cherry picked from commit 54fdeb9e79)
2026-01-13 16:24:56 -08:00
Sam Lantinga
92d6308aac Added support for the Razer Raiju V5 Pro
(cherry picked from commit 015d0fc2e4)
2026-01-13 15:48:35 -08:00
Anonymous Maarten
a2f3e2ac23 cmake: compile SDL_uclibc separately for shared and static SDL3, ensuring fPIC for shared SDL3
(cherry picked from commit 6f19fecba3)
2026-01-13 23:28:25 +01:00
Sergei Petunin
e1b020f340 Fix MAC_PRESS_AND_HOLD hint documentation
(cherry picked from commit 460b8a0db1)
2026-01-13 09:01:42 -08:00
Frank Praznik
c88049d27f wayland: Send exposure events when deferring resize events
Clients that defer repainting may hang in SDL_WaitEvent() while interactively resizing if they only redraw when an appropriate event is received, as resizing defers the new state until a frame callback is received, and if too much time elapsed since the last redraw, the last frame callback may have already occurred. Send an exposure event when deferring resizes so the client will make forward progress and trigger a frame callback to ack the pending configure state.

(cherry picked from commit 2212c4f085)
2026-01-12 20:05:24 -05:00
Qiu Qiang
3cd5a407b8 Fix duplicate event dispatch in Cocoa event pump
Prevent mouse and keyboard events from being processed twice by
skipping [super sendEvent:] for events SDL has already handled via
Cocoa_DispatchEvent. Other event types still go through AppKit's
normal handling.

(cherry picked from commit dd52dd8995)
2026-01-12 11:30:02 -08:00
Frank Praznik
75ff70b489 joystick/win32: Fix function return type mismatch
Fixes #14804

(cherry picked from commit 55acc0b829)
2026-01-11 10:57:24 -05:00
Ethan Lee
f6a979d7e8 events: Buildfix for targets with C++ build units 2026-01-09 14:51:23 -05:00
Katharine Chui
f4b937adf8 haptic hidapi: maintain effects array for external checking
(cherry picked from commit 2bb463921f)
2026-01-08 14:05:26 -08:00
Ozkan Sezer
6aa227a428 stb_image.h (stbi__start_mem): initialize io.skip and io.eof to NULL
Patch authored by @NBickford-NV: https://github.com/miniupnp/stb/pull/1
c.f.: https://github.com/nothings/stb/pull/1751

(cherry picked from commit ab900a389f)
2026-01-08 23:23:02 +03:00
Sam Lantinga
cc0755881c Fixed crash when the broken EZFRD64.DLL is present
Fixes https://github.com/ppy/osu/issues/13634

(cherry picked from commit f369e804e2)
2026-01-07 20:32:07 -08:00
limb-soup
f1b2fa5b9b pthread: add call to pthread_mutexattr_destroy (#14786)
(cherry picked from commit f805bb53cf)
2026-01-07 10:56:25 -08:00
DarkContact
a4b7a77d70 Add support for GPU ARGB1555 (B5G5R5A1_UNORM) textures with DX11
(cherry picked from commit 044aed1f27)
2026-01-07 10:12:46 -08:00
bubbleguuum
06a6adf2b0 x11: fix compilation failure on older XInput2
Older versions of XInput2 do not declare struct XIGesturePinchEvent
in XInput2.h, causing compilation failure in SDL_x11xinput2.c

Check for XIGesturePinchEvent in the test for enabling
SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_GESTURE

(cherry picked from commit 7690e00f42)
2026-01-06 06:49:53 -08:00
Sam Lantinga
08b2176a80 Fixed conflict when linking both SDL and hidapi statically
Closes https://github.com/libsdl-org/SDL/pull/14772

(cherry picked from commit bc68c1c920)
2026-01-06 06:10:51 -08:00
Anonymous Maarten
99b2344253 cmake: add SDL_FULL_VERSION target property containing full SDL version
(cherry picked from commit d73e74f9bf)
2026-01-06 04:05:04 +01:00
Anonymous Maarten
35a891d0e9 cmake: rpi videocore needs brcmegl as well
(cherry picked from commit cd31381185)
2026-01-05 23:45:59 +01:00
Mathieu Eyraud
0394e2e583 Fix Mouse button index
(cherry picked from commit c9baf208bd)
2026-01-05 16:08:38 -05:00
Frank Praznik
8a418521e1 wayland: Check focus when dispatching relative motion
In rare cases, a leave event can be grouped with relative motion in a frame. Ensure a valid focus window when dispatching relative motion.

(cherry picked from commit fab42a1432)
2026-01-05 13:44:09 -05:00
Katharine Chui
fa894b07be hidapi: Disable hidapi LG4FF on windows (#14762)
hid.dll simply cannot send 7 bytes reports unlike other platforms

It enforces full length repots of 17 from the device's descriptor,
which does not work on the device.

This breaks ffb and led control, so we disable this by default on
windows.

(cherry picked from commit 6c2f9bc41e)
2026-01-05 08:14:45 -08:00
Sam Lantinga
832b2aaf39 Don't call SDL_Gtk_Quit() on private platforms
(cherry picked from commit c742038aa9)
2026-01-05 08:08:51 -08:00
Sam Lantinga
3f58b99b53 Fixed handling status changes in the FlyDigi controller driver
(cherry picked from commit ce6a6d1b39)
2026-01-05 08:00:13 -08:00
Ethan Lee
406cd277d2 render: Add support for private-platform shaders in GPU backend 2026-01-05 09:49:15 -05:00
Lucas Murray
9a5700e9a3 GPU: Add error message to Vulkan buffer creation error path
(cherry picked from commit cced3ce8b9)
2026-01-04 15:18:11 -08:00
Sam Lantinga
2237a8eba2 Fixed building with Xcode 15.4
Fixes https://github.com/libsdl-org/SDL/issues/14740

(cherry picked from commit 504041a1ba)
2026-01-03 08:04:59 -08:00
Qiu Qiang
0bc2296756 Cache CGDisplayPixelsHigh result on macOS to reduce IPC overhead
CGDisplayPixelsHigh(kCGDirectMainDisplay) involves an IPC call to the
Window Server on each invocation. Cache the main display height in
SDL_CocoaVideoData and update it only when display configuration changes,
reducing overhead during high-frequency mouse event processing.

(cherry picked from commit 3ee8d1406c)
2026-01-02 12:29:36 -08:00
Ethan Lee
a85a6364d8 ci: Add steamrt4 workflows 2026-01-02 12:19:08 -05:00
Sam Lantinga
9fbba079b9 Update the iOS Xcode build requirements
(cherry picked from commit 7edcc413e8)
2026-01-02 08:53:40 -08:00
Sam Lantinga
3d651ee403 iOS: if the file doesn't exist in the pref path, use the current directory
Fixes https://github.com/libsdl-org/SDL/issues/14743

(cherry picked from commit a0307589bd)
2026-01-02 08:19:45 -08:00
Joshua Vandaële
8de01986b1 Fix dynamic library handling for LibUSB
`target_get_dynamic_library` should not be called if `SDL_HIDAPI_LIBUSB_SHARED` is set to OFF, it otherwise causes a warning at best, or a build failure if libusb is provided by a parent project and not installed on the system

(cherry picked from commit 4a29b6a651)
2026-01-02 07:39:42 -08:00
Ethan Lee
cbed9bd54d gpu: D3D12 uploads should also factor in block size for height, not just width.
It turns out the reason this function was having so many overread issues was because our row copies were wrong - for compressed images we also need to reduce the row count based on the block size, similar to what we already do for pitch calculation - these copies are byte copies, not pixel copies!

(cherry picked from commit f472f93db8)
2026-01-02 07:37:56 -08:00
Zack Middleton
fd345ae2f9 Improve hint documentation
(cherry picked from commit 6247568a1b)
2026-01-02 07:33:17 -08:00
Kadir
c5dee0feb5 Add ProGuard rule for joystickSetLED method in SDLControllerManager
(cherry picked from commit cbcc565ca9)
2026-01-02 07:31:37 -08:00
Brad Smith
a6ff5646f4 cmake: Enable Vulkan support on OpenBSD
(cherry picked from commit 1d51671cbe)
2026-01-02 00:18:38 +01:00
Sam Lantinga
80c6a5f8d9 Updated copyright for 2026 2026-01-01 09:48:19 -08:00
Sam Lantinga
d15ecb21be Updated to version 3.4.1 for development 2025-12-31 18:18:45 -08:00
Sam Lantinga
a962f40bbb Updated to version 3.4.0 for release 2025-12-31 16:43:54 -08:00
Frank Praznik
cac2460623 x11: Don't dedup move/size events
The event core will do so automatically, and this may end up dropping events in rare cases when exiting fullscreen if an event with the final bordered window size is sent before the event notifying that the borders have come back on.
2025-12-31 17:55:32 -05:00
Ryan C. Gordon
25e33948af emscripten: Handle mouse button events more correctly.
Don't decide if the button is pressed by the `buttons` bitmask, but rather by
event type. On macOS, the trackpad might produce a mousedown event with taps
instead of full clicks--if tapping is enabled in System Preferences--and in
this case might not set the flag in the bitmask.

Fixes #14640.
2025-12-31 17:23:42 -05:00
Sam Lantinga
9698e20399 gpu renderer: fixed memory leak when resizing the backbuffer
Fixes https://github.com/libsdl-org/SDL/issues/14734
2025-12-31 08:00:26 -08:00
Sam Lantinga
0ac6f972f9 Added enhanced support for the Flydigi Vader 5 Pro controller 2025-12-31 07:46:56 -08:00
Anonymous Maarten
d7a2d007d0 Remove superfluous comma from SDL_missing_dependency calls 2025-12-31 04:23:27 +01:00
Frank Praznik
cb4f33b644 gpu: Use the window event watcher list for Vulkan and D3D12
Events won't be delivered to the regular event watcher list callbacks if a client event filter discards events. Use the special window event watcher list to watch for resizes in the GPU renderers, as events are delivered to this list before a client can potentially discard them.
2025-12-30 22:18:19 -05:00
Ryan C. Gordon
4d8f84f161 timer: Use the emscripten-specific code on Emscripten, even with threading.
Fixes #14640.
2025-12-30 18:57:55 -05:00
dwillbarron
618eb57519 DirectInput FFB: Calculate appropriate update flags (#14570)
Anecdotally, some force-feedback wheels have been reported to experience a
reduced "definition", "texture", "precision", or "je ne sais quoi", which
appears to be caused by sending more update flags than necessary to
DirectInput.

This may be related to the fact that there are two USB PID packets that are
sent when updating a device: One contains the "general" force data, and the
other contains the "type-specific" data. My speculation is that many wheels
expect to only receive the latter, and misbehave when receiving both.

This has been tested and validated anecdotally by others who have received
a hacked-together version of PCSX2 that corrects the flags sent to DirectInput,
who noted a significant improvement in the "feeling" of the FFB effects.

The only way to validate this at a technical level is to grab a wheel that uses
the "generic" DirectInput FFB drivers (which map nearly 1:1 with the USB PID
specification), and inspect the USB packets (e.g. with USBPcap) to check whether
redundant data is being sent.
2025-12-30 14:43:49 -08:00
Sam Lantinga
128b9260ec Added SDL_HINT_HIDAPI_LIBUSB_GAMECUBE
Fixes https://github.com/libsdl-org/SDL/issues/14682
2025-12-30 14:14:51 -08:00
Ryan C. Gordon
1a27b5b838 emscripten: set window->w and ->h when creating with external css sizing.
Fixes #14711.
2025-12-30 16:56:45 -05:00
Ryan C. Gordon
7d66d3271b emscriptenaudio: Don't force reset SDL3.audio_recording/audio_playback.
Otherwise, opening devices for recording and playback at the same time will
cause problems.
2025-12-30 15:40:25 -05:00
Ryan C. Gordon
b681862f14 emscripten: Don't pass an argument to MAIN_THREAD_EM_ASM_INT we don't use.
This upsets things, because you end up calling a javascript function with
more arguments than it expects, and if asserts are enabled, Emscripten notices
this and aborts the program when you hit this code.

Reference Issue #14670.
2025-12-30 15:40:25 -05:00
Eddy Jansson
3d354eeaad Prefer SDL_arraysize()
Replace uses of (sizeof(arr)/sizeof(arr[0]), and similar,
with the SDL_arraysize() macro.
2025-12-30 12:22:03 -08:00
Sam Lantinga
d33642b710 Filter libusb devices early in enumeration
Some device drivers crash if you query things like manufacturer and product name, so make sure we only touch devices that we're really interested in.
2025-12-30 10:52:56 -08:00
Frank Praznik
95ac0ff4d6 wayland: Center non-square icon images
Center icon images instead of scaling to preserve the aspect ratio.
2025-12-29 13:35:18 -05:00
MAJigsaw77
cb04dcd6f8 android: Add RGB LED support for joysticks. 2025-12-29 10:32:02 -08:00
Frank Praznik
4fcb92e0df wayland: Scale non-square icon images
Wayland icons must be square, so scale non-square images to fit a square region instead of failing. This matches X11 behavior.

A warning that the image will be scaled will be logged.
2025-12-29 12:56:42 -05:00
Sam Lantinga
48d6c70f2c Revert "Added note for migrating SDL2 code using SDL_ThreadID()"
This reverts commit becd08f376.
2025-12-29 09:50:18 -08:00
Sam Lantinga
d10fe8bf2f Added a Linux mapping for the Nacon GC100 controller (thanks @elkabyliano!) 2025-12-29 09:43:47 -08:00
Sam Lantinga
becd08f376 Added note for migrating SDL2 code using SDL_ThreadID() 2025-12-29 09:39:59 -08:00
Sam Lantinga
38345adff0 Don't set the active texture when creating a palette
Fixes https://github.com/libsdl-org/SDL/issues/14705
2025-12-29 09:36:13 -08:00
Simon McVittie
370e9407b5 wayland: If GTK is disabled, try to avoid libdecor's GTK plugin
As in the previous commit, loading GTK while setuid or setgid would
result in the process exiting. This is equally true if it's loaded
indirectly, for a libdecor plugin.

libdecor doesn't currently have any API by which it can be asked to
avoid specific plugins, but its GTK plugin declines to initialize if it
detects a non-main thread (because GTK documents that it must only be
used from the main thread), resulting in libdecor falling back to the
lower-priority Cairo plugin. We can make use of this by intentionally
initializing libdecor on another thread if we have been asked to avoid
GTK. This is a bit of a hack, but at worst it should be harmless.

Resolves: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-28 10:19:33 -08:00
Simon McVittie
b6f4e10bf9 unix: If setuid or setgid, don't use GTK
GTK explicitly doesn't support being used setuid or setgid, and if SDL
loads and initializes GTK, GTK will exit the process if it
detects a setgid executable. This is incompatible with the historical
practice of making game executables setgid in order to write out a
shared high-score table on multi-user systems (which is security theatre
at best, because typical game runtime libraries are not hardened against
an untrusted caller, but making it regress would be a user-observable
regression in sdl2-compat).

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-28 10:19:33 -08:00
Simon McVittie
9e0b31b297 unix: Factor out the check for GTK into an internal function
This will allow the same check to be done by the libdecor integration.

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-28 10:19:33 -08:00
Simon McVittie
76352f2931 Document SDL's policy on setuid/setgid executables
Stated briefly, the policy is: don't.

Resolves: https://github.com/libsdl-org/SDL/issues/14717
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-28 10:14:57 -08:00
Frank Praznik
1fee2a9ae0 wayland: Remove redundant mouse button releases
Any pressed buttons are released in the loop when the pointer leaves a surface, so no need to release them again.
2025-12-28 12:42:09 -05:00
Sam Lantinga
9fe5c1512f Added support for extended buttons on Wayland
Fixes https://github.com/libsdl-org/SDL/issues/14681
2025-12-27 14:50:43 -08:00
anonymix007
89dd2426cf Add SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER 2025-12-27 10:23:12 -08:00
Frank Praznik
8c54961de0 wayland: Send mouse coordinates after warping
Currently, no compositor that supports the warp protocol sends a motion event after doing so, so SDL must synthesize one when using the warp protocol, as it did with the locking protocol.

This can be avoided once
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/340 is completed.
2025-12-26 17:22:42 -05:00
SDL Wiki Bot
bb3d78e260 Sync SDL3 wiki -> header
[ci skip]
2025-12-26 18:14:59 +00:00
Frank Praznik
edec0c2ffd hints: Note an additional method for retrieving display connector names 2025-12-26 13:13:30 -05:00
Anonymous Maarten
bf113bbe2a cmake: break dependency cycle when doing an in-source build 2025-12-24 22:18:57 +01:00
Anonymous Maarten
9dd3e2305e dlnote: embed trailing semicolon in SDL_ELF_NOTE_DLOPEN macro 2025-12-24 23:45:50 +03:00
SDL Wiki Bot
e18b301c51 Sync SDL3 wiki -> header
[ci skip]
2025-12-24 19:24:52 +00:00
Anonymous Maarten
58f534708e dlopennote: don't define SDL_ELF_NOTE_DLOPEN when variadic macro's are not supported
Guard with #ifdef SDL_ELF_NOTE_DLOPEN when using older toolchains
2025-12-24 20:23:28 +01:00
Anonymous Maarten
6840bbef58 dlopennote: update documentation and internal variable names 2025-12-24 20:23:28 +01:00
Nintorch
5c03796ac7 Fix Emscripten joysticks having the same name 2025-12-24 07:19:10 -08:00
Nintorch
0f1a705fda Fix Emscripten joystick rumble being swapped 2025-12-24 07:18:07 -08:00
Edgar San Martin, Jr.
bd29d60d3c GPU: Add bounds validation for slot bindings and uniform data pushes. (#14692) 2025-12-23 08:36:06 -08:00
SDL Wiki Bot
419e8600c8 Sync SDL3 wiki -> header
[ci skip]
2025-12-23 07:45:18 +00:00
Anonymous Maarten
e79cfbe520 testcustomcursor: plug memory leak 2025-12-22 22:43:05 +01:00
Anonymous Maarten
2cd84bd581 testcustomcursor: add --frames argument accepting multiple paths 2025-12-22 22:43:05 +01:00
Sam Lantinga
0b9946d7bf Fixed crash when using the NVIDIA Shield controller 2025-12-22 11:29:47 -08:00
Frank Praznik
7fe81f789f tests: Add clipboard clearing functionality to testclipboard
Use Alt+C/P to clear the clipboard/primary selection in testclipboard.
2025-12-22 13:29:28 -05:00
Frank Praznik
9094395b13 wayland: Use the implicit grab serial when clearing the clipboard
Some compositors won't clear the selection without a valid serial.
2025-12-22 13:29:28 -05:00
SDL Wiki Bot
2bc6cf6efd Sync SDL3 wiki -> header
[ci skip]
2025-12-22 16:26:56 +00:00
Edgar San Martin, Jr.
00fe482efb docs(gpu): document depth texture limitation in SDL_CopyGPUTextureToTexture (#14693) 2025-12-22 08:25:32 -08:00
Alex Schwartz
bd35a1c8e5 docs: fix Fedora 40+ build dependencies 2025-12-22 08:22:40 -08:00
999pingGG
5a257202d2 GPU: Better detection of surface destruction 2025-12-21 17:16:34 -08:00
Sam Lantinga
efc33633e3 Allow the offscreen and dummy drivers to be used as fallback 2025-12-21 16:18:07 -08:00
Frank Praznik
37fca1fdcf video: Unload GL/Vulkan when shutting down the video subsystem
If GL/Vulkan was loaded manually via a SDL_X_LoadLibrary() call instead of via window flags or through the GPU or renderer system, and there is no matching SDL_X_UnloadLibrary() call, the library instance won't be automatically unloaded while shutting down the video system, as the refcount won't go to zero, which can cause problems with some backends, and leaves a leaked DLL/SO handle when the global video object is destroyed.

Ensure that the libraries are unloaded after destroying the windows, but before shutting down the video backend, to prevent a leak and possible driver errors when shutting down the video backend.
2025-12-21 12:44:19 -05:00
SDL Wiki Bot
b14aceea51 Sync SDL3 wiki -> header
[ci skip]
2025-12-21 16:53:21 +00:00
Sam Lantinga
59961d8343 Note that "auto" is the default for SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Fixes https://github.com/libsdl-org/SDL/issues/14686
2025-12-21 08:51:26 -08:00
Kaleb Reid
341f60555f Fix building joystick for OpenBSD 2025-12-21 07:58:41 -08:00
Sam Lantinga
0d705ca275 Use the aggregate upower device for power status when available 2025-12-19 17:42:33 -08:00
999pingGG
190b902fac GPU: Fix Android surface and swapchain recreation on app resume (#14676) 2025-12-19 09:54:08 -08:00
Ryan C. Gordon
2c3657a0ce egl: Patched to compile.
Yeehaw, cowboy committer!  🤦
2025-12-17 17:27:51 -05:00
Ryan C. Gordon
46df9ea92a egl: Call SDL_EGL_SetSwapInterval during context creation, not the GL version.
The `GL` version returns early because the context isn't set yet, whereas the
`EGL` version works out here.

Fixes #14642.
2025-12-17 17:16:39 -05:00
Frank Praznik
235f417616 wayland: Update the HDR data on placeholder displays
Update the HDR data on a placeholder display if it hasn't been finalized and added yet, or the HDR data on the added display will be incorrect.
2025-12-17 15:12:27 -05:00
Frank Praznik
d028d8bc3b Fix minor typos in headers. 2025-12-17 12:56:04 -05:00
Sam Lantinga
63636c8403 Fixed warning: implicit conversion loses integer precision 2025-12-16 14:51:19 -08:00
Sam Lantinga
c7508ca2e9 Fixed warning: no previous prototype for function 'ParseDescriptor' 2025-12-16 14:51:19 -08:00
SDL Wiki Bot
9c856aea96 Sync SDL3 wiki -> header
[ci skip]
2025-12-16 17:57:26 +00:00
Sam Lantinga
d583fc88be Updated to version 3.3.7 for development 2025-12-16 09:38:05 -08:00
Ryan C. Gordon
9022d90e01 README-emscripten: corrected comments about vsync. 2025-12-16 12:24:29 -05:00
Sam Lantinga
ef0a604d44 Updated to version 3.3.6 for preview release 2025-12-16 08:54:04 -08:00
Sam Lantinga
aeb4b3d2fc Reverted Vita cliprect changes
Temporarily backing out cliprect changes which caused logical presentation regressions.

Fixes https://github.com/libsdl-org/SDL/issues/14645
Reopens https://github.com/libsdl-org/SDL/issues/13034
2025-12-16 08:47:45 -08:00
Frank Praznik
78d008fcd2 x11: Don't poll the map state when the window was unmapped and borders are toggled
An event flush while a window is being hidden may try to toggle the window borders. Don't poll the mapping state when toggling borders if the window is in the process of being hidden, or the window may already be unmapped, and the wait loop will hang forever.
2025-12-16 11:45:36 -05:00
Nuno Silva
d94cd1efad GPU: Ensure Vulkan doesn't pass unsupported feature structures for requested vulkan version (#14662) 2025-12-15 17:57:49 -08:00
Edgar J San Martin
09a2283b53 Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows. 2025-12-15 17:01:02 -08:00
Anonymous Maarten
6665ebaa2e SDL_test: allow disabling colorized output 2025-12-15 23:19:25 +01:00
Susko3
765a2e9118 Fix using wrong variable by mistake 2025-12-15 13:57:40 -08:00
Evan Hemsley
1260c10aab GPU Vulkan: Only modify surface on window claim or release (#14659) 2025-12-15 12:54:16 -08:00
Jakub Wasilewski
73c9f25867 GPU: Metal: Rebind storage buffers when changing the pipeline moves them. 2025-12-15 11:45:29 -08:00
Frank Praznik
9092ddff3c wayland: Update the color management protocol
No functional changes, just minor updates to track the latest upstream version.
2025-12-15 13:54:31 -05:00
Ryan C. Gordon
db84b948f9 egl: Default to a swap interval of 0.
This matches other platforms.

Also make sure Android explicitly sets vsync on restore, regardless of the
specific setting, to make sure it's consistent.

Fixes #14642.
2025-12-15 12:44:57 -05:00
Ryan C. Gordon
deb85d1fa8 emscripten: find the right SDL_Window during fullscreen events.
Fixes #14629.
2025-12-15 12:08:44 -05:00
Sam Lantinga
64df9cfa47 testmessage: quit if we get a mouse click 2025-12-15 08:56:11 -08:00
Sam Lantinga
bcaedd5781 Fixed messageboxes when using window scenes on Apple platforms 2025-12-15 08:56:11 -08:00
Sam Lantinga
518c98ea01 Pass the window along with evdev touch events
Fixes https://github.com/libsdl-org/SDL/issues/14644
2025-12-15 08:29:36 -08:00
SDL Wiki Bot
de642c8890 Sync SDL3 wiki -> header
[ci skip]
2025-12-14 18:40:08 +00:00
Sam Lantinga
ae8df644d7 Refer to SDL_CreateGPUComputePipeline() appropriately 2025-12-14 10:38:10 -08:00
Sam Lantinga
a3e5335dbf Removed wiki markup 2025-12-14 08:20:00 -08:00
SDL Wiki Bot
16b74a6ffa Sync SDL3 wiki -> header
[ci skip]
2025-12-14 16:03:48 +00:00
Sam Lantinga
517a3d20e8 Support calling SteamAPI_InitEx() before SDL_Init(SDL_INIT_GAMEPAD)
Calling SteamAPI_InitEx() will set environment variables that SDL uses to properly support the Steam virtual gamepad. Make sure that we fall back to the real environment for the variables that Steam sets.
2025-12-13 23:46:27 -08:00
Sam Lantinga
d780fa144a Don't create the SDL environment in SDL_setenv_unsafe()
We might be setting an environment variable along with other application code setting environment variables (like code in SteamAPI_InitEx()) before initializing SDL.
2025-12-13 21:28:05 -08:00
Frank Praznik
5fe69e73ba x11: Use XInput2 to handle pointer input while grabbed and touches are active
Core X11 events are used for absolute motion while the mouse is grabbed, as XInput doesn't receive motion events from the master pointer, and the position from the slave devices lags one report behind. However, pointer events emulated from multitouch events can't be filtered out when using core events, as the XInput flags are not passed through.

Use the absolute position from slave devices in XInput motion events while the mouse is grabbed and touch events are active to allow filtering out pointer events emulated from touch events. Pointer events in this case may be a report behind the master device, but receiving input from both the pointer and touches simultaneously is not likely to be a common occurrence.
2025-12-13 11:15:11 -05:00
Sam Lantinga
a2d19ec7f3 Note that uniforms are local to command buffers (thanks @LittleCodingFox!) 2025-12-12 15:09:56 -08:00
Sam Lantinga
ec19f1e12f Use Uint32 instead of unsigned int for descriptor values 2025-12-12 13:02:39 -08:00
Sam Lantinga
71be323973 Updated Xbox HIDAPI descriptor handling for alternate layout
Fixes https://github.com/libsdl-org/SDL/issues/14597
2025-12-12 13:02:39 -08:00
Fredrik Foss-Indrehus
bdb72bb3f0 cmake: add reftable ref storage support to GetGitRevisionDescription
The script assumed Git's traditional loose refs or packed-refs format.
When cloning with extensions.refstorage=reftable, neither .git/refs/*
nor .git/packed-refs exist, causing cmake configuration to fail.

Fall back to git rev-parse when file-based ref lookup fails.
2025-12-11 16:13:49 -08:00
SDL Wiki Bot
76dfb85407 Sync SDL3 wiki -> header
[ci skip]
2025-12-11 23:15:58 +00:00
Frank Praznik
d6f6421973 Revert "Don't enable the text-input protocol when using Fcitx"
It turns out that some distros set SDL_IM_MODULE globally, which leads to broken text input with this check, and there really is no reason not to use the text input protocol when available.

Reverts 2b375d9704
2025-12-11 12:56:49 -05:00
Anonymous Maarten
f8a4fbf128 Remove mkinstalldirs from automake 2025-12-11 05:48:36 +01:00
Arnoldo Adonaí Barón Robles
e5731f9bac GPU: Fix crash on Android upon returning from the background 2025-12-10 20:58:19 -05:00
Frank Praznik
c2710bd4e8 Don't apply SDL_HINT_MOUSE_DPI_SCALE_CURSORS on Wayland
Wayland cursors are surfaces sized in scaled points, so this hint wouldn't change the size, just prevent larger backbuffers from being used to draw sharper scaled cursors.
2025-12-10 14:50:00 -05:00
Sam Lantinga
450a2cb5e4 Added support for parsing the Xbox report descriptor
This gives us more robust handling of Bluetooth Xbox controllers which may vary the report format between firmware versions.

Firmware versions tested:
Xbox One S: 3.1.1, 4.8.1923, 5.13.3143
Xbox One S/X: 5.11.3118, 5.23.6
Xbox Elite Series 2: 5.22.16, 5.23.6

Fixes https://github.com/libsdl-org/SDL/issues/14597
2025-12-10 10:49:39 -08:00
Sam Lantinga
ef416e84a1 Use SDL_LogDebug() for dumping HID packets 2025-12-10 10:49:39 -08:00
SDL Wiki Bot
5bbf1dcb44 Sync SDL3 wiki -> header
[ci skip]
2025-12-10 01:13:34 +00:00
Sam Lantinga
466ca58b04 Added SDL_HINT_MOUSE_DPI_SCALE_CURSORS
We only want to change cursor display scale if the application or the user opts in by setting a hint. Otherwise cursors could change size unexpectedly when upgrading to SDL 3.4.0.
2025-12-09 17:12:08 -08:00
Frank Praznik
5b572638b8 video: Handle window destruction in event handlers
Windows may be destroyed in event handlers, so check the window validity after pushing window events onto the queue to ensure that the window and its properties are still valid.
2025-12-09 14:10:43 -05:00
Qiu Qiang
62639fdf88 Improve camera frame rate matching on macOS
- Prefer formats with narrower frame rate ranges
- Set frame duration on both device and connection
  for better enforcement
2025-12-08 21:03:09 -08:00
Ryan C. Gordon
b3cdeb942a opengl: default to vsync=0 everywhere.
This reverts commit 3ee29f2e7a, among other
changes. This means getting a scary warning on the javascript console in
Emscripten by default, but this is easily fixed by setting a GL swap
interval at startup or creating a 2D renderer with the appropriate property
(or call to SDL_SetRenderVSync()).

Fixes #14625.
2025-12-08 15:12:17 -05:00
Anonymous Maarten
a296c40867 isfinite is not available on all platforms, so add a bitmasking alternative
Compiler Explorer shows both result in the same assembly.
2025-12-08 20:48:47 +01:00
Anonymous Maarten
f896e26f59 tests: find X11 and wayland-client 2025-12-08 20:48:47 +01:00
Anonymous Maarten
d19b010d4e cmake: only enable building tests when SDL is the main project 2025-12-08 20:48:47 +01:00
Frank Praznik
14aa5cf762 x11: Remove unused function parameter 2025-12-08 13:15:12 -05:00
Frank Praznik
69255b870d x11: Dedup the X11_FindWindow() function
The was duplicated in the XInput2 code, but taking an SDL_VideoData parameter instead of SDL_VideoDevice. Remove the duplicated XInput2 function, and use an SDL_VideoData parameter for X11_FindWindow to avoid an unnecessary dereference.
2025-12-08 13:15:12 -05:00
Cameron Cawley
a4de176e1c Use the correct pixel formats for Vulkan on big endian 2025-12-08 10:07:31 -08:00
Sam Lantinga
9b36a76ee6 Fixed supported pixel formats on big endian systems (thanks @ccawley2011!) 2025-12-08 08:36:32 -08:00
SDL Wiki Bot
a75bf983e5 Sync SDL3 wiki -> header
[ci skip]
2025-12-08 16:27:12 +00:00
Ryan C. Gordon
6f774908fe audio: SDL_GetAudioDeviceName() now works with the default device IDs.
Fixes #14615.
2025-12-08 11:25:15 -05:00
Sam Lantinga
a35639c7b5 Added patch note for SDL_SetWindowFillDocument() 2025-12-08 08:18:34 -08:00
Sam Lantinga
db3ee5d62b Enable building the tests by default
A common use case is asking someone to clone SDL and run a test. This simplifies the instructions so we don't also have to tell them how to enable the tests. Anyone savvy can just add -DSDL_TESTS=OFF if they don't want to have them.
2025-12-08 08:15:12 -08:00
Ryan C. Gordon
08a547e077 WhatsNew.txt: Removed reference to removed property.
Fixes #14623.
2025-12-08 11:03:42 -05:00
SDL Wiki Bot
b428c1834f Sync SDL3 wiki -> header
[ci skip]
2025-12-08 03:26:26 +00:00
Ryan C. Gordon
5813d0ec0a surface: SDL_RotateSurface should update SDL_PROP_SURFACE_ROTATION_FLOAT.
Fixes #14616.
2025-12-07 22:25:08 -05:00
Ryan C. Gordon
4194879df1 surface: Surface rotation property should be float, not int.
Adjusted camera internals to work in floats, too.

Reference Issue #14616.
2025-12-07 22:25:08 -05:00
Ryan C. Gordon
9918d6cb5e emscripten: Move fill-document from hint/property to a window flag.
Fixes #14617.
2025-12-07 21:12:13 -05:00
Qiu Qiang
19988c5faa Fix loop variable bug in V4L2 camera format enumeration 2025-12-07 14:11:27 -08:00
Sam Lantinga
7773157fae Updated to version 3.3.5 for development 2025-12-07 09:30:04 -08:00
Sam Lantinga
9bf86a2db3 Added documentation for the 3.4.0 release 2025-12-07 09:18:29 -08:00
Sam Lantinga
edb81cf84a Fixed whitespace 2025-12-07 09:12:34 -08:00
SDL Wiki Bot
9257df24b5 Sync SDL3 wiki -> header
[ci skip]
2025-12-07 16:05:39 +00:00
Sam Lantinga
97b0b13147 Fixed subdirectories showing in enumeration of Steam storage 2025-12-06 22:35:05 -08:00
Christian Semmler
7e78636e8e Handle SharedArrayBuffer for PNG data
The Emscripten support for setting window icons introduced in #14490 does not work when using pthreads. Using `SetWindowIcon` will cause the program to crash. The reason for that is that the `Blob` constructor does not accept shared memory (`SharedArrayBuffer`).

We need to create a local copy of the icon data if necessary.
2025-12-06 22:11:55 -08:00
1261 changed files with 14386 additions and 5922 deletions

View File

@@ -1,3 +1,5 @@
- [ ] I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").
<!--- Provide a general summary of your changes in the Title above -->
## Description

View File

@@ -30,7 +30,7 @@ runs:
echo "cache-key=gdk-${{ inputs.ref }}-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT
- name: 'Restore cached GDK'
id: cache-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
path: '${{ steps.calc.outputs.gdk-path }}'
key: ${{ steps.calc.outputs.cache-key }}
@@ -58,7 +58,7 @@ runs:
--no-user-props
- name: 'Cache GDK'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: '${{ steps.calc.outputs.gdk-path }}'
key: ${{ steps.calc.outputs.cache-key }}

View File

@@ -17,7 +17,7 @@ outputs:
runs:
using: 'composite'
steps:
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: restore-cache
with:
path: /opt/cross-tools
@@ -34,7 +34,7 @@ runs:
mkdir -p /opt
tar -C /opt -x -f /tmp/toolchain.tar.xz
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
if: ${{ !steps.restore-cache.outputs.cache-hit }}
with:
path: /opt/cross-tools

View File

@@ -17,7 +17,7 @@ runs:
steps:
- name: 'Restore cached libusb-${{ inputs.version }}.7z'
id: cache-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
key: libusb-msvc-${{ inputs.version }}
@@ -28,7 +28,7 @@ runs:
Invoke-WebRequest "https://github.com/libusb/libusb/releases/download/v${{ inputs.version }}/libusb-${{ inputs.version }}.7z" -OutFile "C:\temp\libusb-${{ inputs.version }}.7z"
- name: 'Cache libusb-${{ inputs.version }}.7z'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
key: libusb-msvc-${{ inputs.version }}

View File

@@ -7,7 +7,7 @@ inputs:
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: 'Verify platform'
@@ -52,7 +52,7 @@ runs:
echo "extras-branch=${extras_branch}" >> ${GITHUB_OUTPUT}
# - name: 'Restore cached ${{ steps.calc.outputs.archive }}'
# id: cache-restore
# uses: actions/cache/restore@v4
# uses: actions/cache/restore@v5
# with:
# path: '${{ runner.temp }}'
# key: ${{ steps.calc.outputs.cache-key }}
@@ -68,7 +68,7 @@ runs:
# - name: 'Cache ${{ steps.calc.outputs.archive }}'
# if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
# uses: actions/cache/save@v4
# uses: actions/cache/save@v5
# with:
# path: |
# ${{ runner.temp }}/apps.zip

View File

@@ -36,7 +36,7 @@ runs:
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
@@ -47,7 +47,7 @@ runs:
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}

View File

@@ -33,7 +33,7 @@ runs:
exit 1
;;
esac
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: restore-cache
with:
path: /vita/dependencies
@@ -81,7 +81,7 @@ runs:
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
if: ${{ !steps.restore-cache.outputs.cache-hit }}
with:
path: /vita/dependencies

View File

@@ -25,6 +25,7 @@ class MsvcArch(Enum):
class JobOs(Enum):
WindowsLatest = "windows-latest"
Windows2022 = "windows-2022"
UbuntuLatest = "ubuntu-latest"
MacosLatest = "macos-latest"
Ubuntu22_04 = "ubuntu-22.04"
@@ -113,12 +114,13 @@ JOB_SPECS = {
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.Windows2022, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ),
"ubuntu-latest": JobSpec(name="Ubuntu (latest)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-ubuntu-latest", ),
"ubuntu-24.04-arm64": JobSpec(name="Ubuntu 24.04 (ARM64)", os=JobOs.Ubuntu24_04_arm, platform=SdlPlatform.Linux, artifact="SDL-ubuntu24.04-arm64", ),
"steamrt3": JobSpec(name="Steam Linux Runtime 3.0 (x86_64)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-steamrt3", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest", more_hard_deps = True, ),
"steamrt3-arm64": JobSpec(name="Steam Linux Runtime 3.0 (arm64)", os=JobOs.Ubuntu24_04_arm, platform=SdlPlatform.Linux, artifact="SDL-steamrt3-arm64", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk/arm64:latest", more_hard_deps = True, ),
"steamrt3": JobSpec(name="Steam Linux Runtime 3.0 (x86_64)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-steamrt3", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest" ),
"steamrt4": JobSpec(name="Steam Linux Runtime 4.0 (x86_64)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-steamrt4", container="registry.gitlab.steamos.cloud/steamrt/steamrt4/sdk:latest", more_hard_deps = True, ),
"steamrt4-arm64": JobSpec(name="Steam Linux Runtime 4.0 (arm64)", os=JobOs.Ubuntu24_04_arm, platform=SdlPlatform.Linux, artifact="SDL-steamrt4-arm64", container="registry.gitlab.steamos.cloud/steamrt/steamrt4/sdk/arm64:latest", more_hard_deps = True, ),
"ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ),
"ubuntu-intel-icc": JobSpec(name="Ubuntu 22.04 (Intel Compiler)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-icc", intel=IntelCompiler.Icc, ),
"macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos14, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ),
@@ -210,8 +212,7 @@ class JobDetails:
minidump: bool = False
intel: bool = False
msys2_msystem: str = ""
msys2_env: str = ""
msys2_no_perl: bool = False
msys2_packages: list[str] = dataclasses.field(default_factory=list)
werror: bool = True
msvc_vcvars_arch: str = ""
msvc_vcvars_sdk: str = ""
@@ -246,8 +247,7 @@ class JobDetails:
"enable-artifacts": enable_artifacts,
"shell": self.shell,
"msys2-msystem": self.msys2_msystem,
"msys2-env": self.msys2_env,
"msys2-no-perl": self.msys2_no_perl,
"msys2-packages": my_shlex_join(self.msys2_packages),
"android-ndk": self.android_ndk,
"java": self.java,
"intel": self.intel,
@@ -735,15 +735,26 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.shell = "msys2 {0}"
assert spec.msys2_platform
job.msys2_msystem = spec.msys2_platform.value
job.msys2_env = {
job.shared_lib = SharedLibType.WIN32
job.static_lib = StaticLibType.A
msys2_env = {
"mingw32": "mingw-w64-i686",
"mingw64": "mingw-w64-x86_64",
"clang64": "mingw-w64-clang-x86_64",
"ucrt64": "mingw-w64-ucrt-x86_64",
}[spec.msys2_platform.value]
job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, )
job.shared_lib = SharedLibType.WIN32
job.static_lib = StaticLibType.A
job.msys2_packages.extend([
f"{msys2_env}-cc",
f"{msys2_env}-cmake",
f"{msys2_env}-ffmpeg",
f"{msys2_env}-ninja",
f"{msys2_env}-pkg-config",
])
if spec.msys2_platform not in (Msys2Platform.Mingw32, ):
job.msys2_packages.append(f"{msys2_env}-perl")
job.msys2_packages.append(f"{msys2_env}-clang-tools-extra")
if job.ccache:
job.msys2_packages.append(f"{msys2_env}-ccache")
case SdlPlatform.Riscos:
job.ccache = False # FIXME: enable when container gets upgrade
# FIXME: Enable SDL_WERROR

View File

@@ -27,15 +27,7 @@ jobs:
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.platform.msys2-msystem }}
install: >-
${{ matrix.platform.msys2-env }}-cc
${{ matrix.platform.msys2-env }}-cmake
${{ matrix.platform.msys2-env }}-ffmpeg
${{ matrix.platform.msys2-env }}-ninja
${{ (!matrix.platform.msys2-no-perl && format('{0}-perl', matrix.platform.msys2-env)) || '' }}
${{ matrix.platform.msys2-env }}-pkg-config
${{ matrix.platform.msys2-env }}-clang-tools-extra
${{ (matrix.platform.ccache && format('{0}-ccache', matrix.platform.msys2-env)) || '' }}
install: ${{ matrix.platform.msys2-packages }}
- name: 'About this job'
run: |
echo "key=${{ matrix.platform.key }}"
@@ -43,7 +35,7 @@ jobs:
echo "os=${{ matrix.platform.os }}"
echo ""
echo "Add [sdl-ci-filter ${{ matrix.platform.key }}] to your commit message to reduce the number of jobs."
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: 'Set up ninja'
if: ${{ matrix.platform.setup-ninja }}
uses: ./.github/actions/setup-ninja
@@ -52,11 +44,11 @@ jobs:
uses: ./.github/actions/setup-msvc-libusb
with:
arch: ${{ matrix.platform.setup-libusb-arch }}
- uses: mymindstorm/setup-emsdk@v14
- uses: mymindstorm/setup-emsdk@v15
if: ${{ matrix.platform.platform == 'emscripten' }}
with:
version: 3.1.35
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-chrome@v2
id: setup-chrome
if: ${{ matrix.platform.platform == 'emscripten' }}
with:
@@ -84,7 +76,7 @@ jobs:
run: |
# We cannot use GitHub expressions in the controller job
echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >>$GITHUB_ENV
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
if: ${{ matrix.platform.java }}
with:
distribution: 'temurin'
@@ -179,7 +171,7 @@ jobs:
echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT"
- name: 'Restore ccache'
if: ${{ matrix.platform.ccache }}
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
id: restore-ccache
with:
path: ${{ runner.temp }}/ccache
@@ -327,7 +319,7 @@ jobs:
- name: 'Build (cross-platform-actions, BSD)'
id: cpactions
if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.29.0
uses: cross-platform-actions/action@v0.32.0
with:
operating_system: '${{ matrix.platform.cpactions-os }}'
architecture: '${{ matrix.platform.cpactions-arch }}'
@@ -357,7 +349,7 @@ jobs:
- name: Add msbuild to PATH
id: setup-msbuild
if: ${{ matrix.platform.msvc-project != '' }}
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v3
- name: Build msbuild
if: ${{ matrix.platform.msvc-project != '' }}
run: |
@@ -401,7 +393,7 @@ jobs:
ccache -s
- name: 'Save ccache'
if: ${{ matrix.platform.ccache }}
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: ${{ runner.temp }}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
@@ -421,7 +413,7 @@ jobs:
run: |
find ./ -iname '*.so' | xargs -L1 ./build-scripts/check_elf_alignment.sh
- name: 'Upload binary package'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') && (matrix.platform.enable-artifacts || steps.tests.outcome == 'failure') }}
with:
if-no-files-found: error
@@ -430,14 +422,14 @@ jobs:
build/dist/SDL3*
build/include*
- name: 'Upload minidumps'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: ${{ always() && steps.tests.outcome == 'failure' && (matrix.platform.platform == 'msvc' || matrix.platform.platform == 'msys2') }}
with:
if-no-files-found: ignore
name: '${{ matrix.platform.artifact }}-minidumps'
path: build/**/*.dmp
- name: "Upload Android test apk's"
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: ${{ matrix.platform.enable-artifacts && always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }}
with:
if-no-files-found: error

View File

@@ -20,15 +20,15 @@ jobs:
src-zip: ${{ steps.releaser.outputs.src-zip }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Set up SDL sources'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: 'SDL'
fetch-depth: 0
@@ -43,7 +43,7 @@ jobs:
--github \
--debug
- name: 'Store source archives'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: sources
path: '${{ github.workspace}}/dist'
@@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
@@ -114,15 +114,15 @@ jobs:
dmg: ${{ steps.releaser.outputs.dmg }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
@@ -143,7 +143,7 @@ jobs:
--github \
--debug
- name: 'Store DMG image file'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: dmg
path: '${{ github.workspace }}/dist'
@@ -153,12 +153,12 @@ jobs:
runs-on: macos-latest
steps:
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download ${{ needs.dmg.outputs.dmg }}'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: dmg
path: '${{ github.workspace }}'
@@ -322,15 +322,15 @@ jobs:
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
@@ -351,7 +351,7 @@ jobs:
--github `
--debug
- name: 'Store MSVC archives'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: win32
path: '${{ github.workspace }}/dist'
@@ -361,16 +361,16 @@ jobs:
runs-on: windows-latest
steps:
- name: 'Fetch .github/actions/setup-ninja/action.yml'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: '.github/actions/setup-ninja/action.yml'
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download MSVC binaries'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: win32
path: '${{ github.workspace }}'
@@ -481,11 +481,11 @@ jobs:
mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Install Mingw toolchain'
@@ -493,7 +493,7 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
@@ -513,7 +513,7 @@ jobs:
--github \
--debug
- name: 'Store MinGW archives'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: mingw
path: '${{ github.workspace }}/dist'
@@ -527,12 +527,12 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download MinGW binaries'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: mingw
path: '${{ github.workspace }}'
@@ -582,11 +582,11 @@ jobs:
android-aar: ${{ steps.releaser.outputs.android-aar }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Setup Android NDK'
@@ -596,7 +596,7 @@ jobs:
local-cache: false
ndk-version: r28c
- name: 'Setup Java JDK'
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '11'
@@ -605,7 +605,7 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
@@ -627,7 +627,7 @@ jobs:
--github \
--debug
- name: 'Store Android archive(s)'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: android
path: '${{ github.workspace }}/dist'
@@ -637,20 +637,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: 'Download source archives'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download Android .aar archive'
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: android
path: '${{ github.workspace }}'

20
AGENTS.md Normal file
View File

@@ -0,0 +1,20 @@
AI must not be used to generate code for contributions to this project.
"AI" in this case means a Large Language Model ("LLM"), such as ChatGPT,
Claude, Copilot, Grok, etc.
AI-generated code is based upon sources of unknown origins and may not be
compatible with the Zlib license, or may introduce conflicting license terms
if they include code from other projects.
AI can be used to identify issues with contributions to this project, but the
solutions to those issues should be authored by humans.
We have found that AI will frequently hallucinate issues that are not actually
problems in practice, report incorrect information, and describe problems that
are actually not issues at all. If AI identifies a problem with this codebase,
please make sure you understand what it is saying and have independently
confirmed that the issue exists before submitting a bug report or pull request.
Any pull request to this project will ask you to confirm that you are the
author and that you are contributing your changes under the Zlib license.

22
CLAUDE.md Normal file
View File

@@ -0,0 +1,22 @@
AI must not be used to generate code for contributions to this project.
"AI" in this case means a Large Language Model ("LLM"), such as ChatGPT,
Claude, Copilot, Grok, etc.
AI-generated code is based upon sources of unknown origins and may not be
compatible with the Zlib license, or may introduce conflicting license terms
if they include code from other projects.
AI can be used to identify issues with contributions to this project, but the
solutions to those issues should be authored by humans.
We have found that AI will frequently hallucinate issues that are not actually
problems in practice, report incorrect information, and describe problems that
are actually not issues at all. If AI identifies a problem with this codebase,
please make sure you understand what it is saying and have independently
confirmed that the issue exists before submitting a bug report or pull request.
Any pull request to this project will ask you to confirm that you are the
author and that you are contributing your changes under the Zlib license.

View File

@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif()
# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.3.4")
project(SDL3 LANGUAGES C VERSION "3.4.12")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON)
@@ -46,6 +46,7 @@ endif()
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckLanguage)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
@@ -367,7 +368,7 @@ dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SD
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;APPLE" OFF)
dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR OPENBSD OR WINDOWS" OFF)
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF)
dep_option(SDL_METAL "Enable Metal support" ON "APPLE" OFF)
set_option(SDL_OPENVR "Use OpenVR video driver" OFF)
@@ -378,7 +379,7 @@ dep_option(SDL_DUMMYCAMERA "Support the dummy camera driver" ON SDL_CAME
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" OFF)
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" OFF)
dep_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON "NOT VISIONOS" OFF)
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" ON SDL_HIDAPI_LIBUSB_AVAILABLE OFF)
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" ON "SDL_HIDAPI;SDL_HIDAPI_LIBUSB_AVAILABLE" OFF)
dep_option(SDL_HIDAPI_LIBUSB_SHARED "Dynamically load libusb support" ON "SDL_HIDAPI_LIBUSB;SDL_DEPS_SHARED" OFF)
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
@@ -387,13 +388,17 @@ set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF)
if(EMSCRIPTEN)
option_string(SDL_EMSCRIPTEN_PERSISTENT_PATH "Path to mount Emscripten IDBFS at startup or '' to disable" "")
endif()
set(SDL_VENDOR_INFO "" CACHE STRING "Vendor name and/or version to add to SDL_REVISION")
cmake_dependent_option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_DEFAULT} ${SDL_SHARED_AVAILABLE} OFF)
cmake_dependent_option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_DEFAULT} ${SDL_STATIC_AVAILABLE} OFF)
option(SDL_TEST_LIBRARY "Build the SDL3_test library" ON)
dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST_LIBRARY OFF)
dep_option(SDL_TESTS "Build the test directory" ${SDL3_MAINPROJECT} SDL_TEST_LIBRARY OFF)
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "SDL_INSTALL;NOT SDL_FRAMEWORK" OFF)
dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}")
set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines")
@@ -658,12 +663,7 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
endif()
endif()
if(APPLE)
check_linker_flag(C "-Wl,-undefined,error" LINKER_SUPPORTS_WL_UNDEFINED_ERROR)
if(LINKER_SUPPORTS_WL_UNDEFINED_ERROR)
sdl_shared_link_options("-Wl,-undefined,error")
endif()
elseif(NOT OPENBSD)
if(NOT OPENBSD)
cmake_push_check_state()
check_linker_flag(C "-Wl,--no-undefined" LINKER_SUPPORTS_WL_NO_UNDEFINED)
#FIXME: originally this if had an additional "AND NOT (USE_CLANG AND WINDOWS)"
@@ -1097,7 +1097,7 @@ if(SDL_LIBC)
)
if(WINDOWS)
list(APPEND symbols_to_check
_copysign _fseeki64 _strrev _ui64toa _uitoa _ultoa _wcsdup
_copysign _fseeki64 _strrev _ui64toa _ultoa _wcsdup
)
else()
list(APPEND symbols_to_check
@@ -1161,6 +1161,8 @@ if(SDL_LIBC)
check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
check_symbol_exists(gethostname "unistd.h" HAVE_GETHOSTNAME)
check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
check_symbol_exists(getresgid "unistd.h" HAVE_GETRESGID)
check_symbol_exists(getresuid "unistd.h" HAVE_GETRESUID)
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
@@ -1177,34 +1179,33 @@ if(SDL_LIBC)
check_symbol_exists(posix_fallocate "fcntl.h" HAVE_POSIX_FALLOCATE)
check_symbol_exists(posix_spawn_file_actions_addchdir "spawn.h" HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
check_symbol_exists(posix_spawn_file_actions_addchdir_np "spawn.h" HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)
endif()
if(SDL_SYSTEM_ICONV)
check_c_source_compiles("
#define LIBICONV_PLUG 1 /* in case libiconv header is in include path */
#include <stddef.h>
#include <iconv.h>
int main(int argc, char **argv) {
return !iconv_open(NULL,NULL);
}" ICONV_IN_LIBC)
if(SDL_SYSTEM_ICONV)
check_c_source_compiles("
#define LIBICONV_PLUG 1 /* in case libiconv header is in include path */
#include <stddef.h>
#include <iconv.h>
int main(int argc, char **argv) {
return !iconv_open(NULL,NULL);
}" ICONV_IN_LIBC)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES iconv)
check_c_source_compiles("
#include <stddef.h>
#include <iconv.h>
int main(int argc, char **argv) {
return !iconv_open(NULL,NULL);
}" ICONV_IN_LIBICONV)
cmake_pop_check_state()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES iconv)
check_c_source_compiles("
#include <stddef.h>
#include <iconv.h>
int main(int argc, char **argv) {
return !iconv_open(NULL,NULL);
}" ICONV_IN_LIBICONV)
cmake_pop_check_state()
if(ICONV_IN_LIBC OR ICONV_IN_LIBICONV)
set(HAVE_ICONV 1)
set(HAVE_SYSTEM_ICONV TRUE)
if(ICONV_IN_LIBICONV AND (SDL_LIBICONV OR (NOT ICONV_IN_LIBC)))
sdl_link_dependency(iconv LIBS iconv)
set(SDL_USE_LIBICONV 1)
set(HAVE_LIBICONV TRUE)
endif()
if(ICONV_IN_LIBC OR ICONV_IN_LIBICONV)
set(HAVE_ICONV 1)
set(HAVE_SYSTEM_ICONV TRUE)
if(ICONV_IN_LIBICONV AND (SDL_LIBICONV OR (NOT ICONV_IN_LIBC)))
sdl_link_dependency(iconv LIBS iconv)
set(SDL_USE_LIBICONV 1)
set(HAVE_LIBICONV TRUE)
endif()
endif()
@@ -1292,22 +1293,25 @@ sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/*.h"
)
# Build uclibc as a static library such that non-used symbols don't end up in the SDL3 shared library.
file(GLOB SDL_UCLIBC_SOURCES "${SDL3_SOURCE_DIR}/src/libm/*.c")
add_library(SDL_uclibc STATIC "${SDL_UCLIBC_SOURCES}")
target_compile_definitions(SDL_uclibc PRIVATE USING_GENERATED_CONFIG_H)
target_include_directories(SDL_uclibc PRIVATE "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config")
target_include_directories(SDL_uclibc PRIVATE "${SDL3_SOURCE_DIR}/src")
target_include_directories(SDL_uclibc PRIVATE "${SDL3_SOURCE_DIR}/include")
SDL_AddCommonCompilerFlags(SDL_uclibc)
target_compile_definitions(SDL_uclibc PRIVATE "$<$<CONFIG:Debug>:DEBUG>")
sdl_sources(STATIC "$<TARGET_OBJECTS:SDL_uclibc>")
set_property(TARGET SDL_uclibc PROPERTY UNITY_BUILD OFF)
if(TARGET SDL3-shared)
# Build uclibc as a static library such that non-used symbols don't end up in the SDL3 shared library.
add_library(SDL_uclibc STATIC ${SDL_UCLIBC_SOURCES})
set_property(TARGET SDL_uclibc PROPERTY POSITION_INDEPENDENT_CODE TRUE)
target_compile_definitions(SDL_uclibc PRIVATE USING_GENERATED_CONFIG_H)
target_include_directories(SDL_uclibc PRIVATE "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config")
target_include_directories(SDL_uclibc PRIVATE "${SDL3_SOURCE_DIR}/src")
target_include_directories(SDL_uclibc PRIVATE "${SDL3_SOURCE_DIR}/include")
SDL_AddCommonCompilerFlags(SDL_uclibc)
target_compile_definitions(SDL_uclibc PRIVATE "$<$<CONFIG:Debug>:DEBUG>")
set_property(TARGET SDL_uclibc PROPERTY UNITY_BUILD OFF)
target_link_libraries(SDL3-shared PRIVATE SDL_uclibc)
if(HAVE_GCC_FVISIBILITY)
set_property(TARGET SDL_uclibc PROPERTY C_VISIBILITY_PRESET "hidden")
endif()
endif()
if(HAVE_GCC_FVISIBILITY)
set_property(TARGET SDL_uclibc PROPERTY C_VISIBILITY_PRESET "hidden")
if(TARGET SDL3-static)
target_sources(SDL3-static PRIVATE ${SDL_UCLIBC_SOURCES})
endif()
# Enable/disable various subsystems of the SDL library
@@ -1651,6 +1655,11 @@ elseif(EMSCRIPTEN)
# project. Uncomment at will for verbose cross-compiling -I/../ path info.
sdl_compile_options(PRIVATE "-Wno-warn-absolute-paths")
if(NOT SDL_EMSCRIPTEN_PERSISTENT_PATH STREQUAL "")
set(SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING "${SDL_EMSCRIPTEN_PERSISTENT_PATH}")
sdl_link_dependency(idbfs LIBS idbfs.js)
endif()
sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/main/emscripten/*.c"
"${SDL3_SOURCE_DIR}/src/main/emscripten/*.h"
@@ -1764,6 +1773,7 @@ elseif(EMSCRIPTEN)
elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
set(SDL_DISABLE_DLOPEN_NOTES TRUE)
if(SDL_DLOPEN_NOTES)
set(CHECK_ELF_DLNOTES_SRC [==[
#ifndef __ELF__
@@ -1776,10 +1786,10 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
return argc + dlnote.hdr.a;
}
]==])
set(SDL_DISABLE_DLOPEN_NOTES FALSE)
check_c_source_compiles("${CHECK_ELF_DLNOTES_SRC}" COMPILER_SUPPORTS_ELFNOTES)
if(NOT COMPILER_SUPPORTS_ELFNOTES)
set(SDL_DISABLE_DLOPEN_NOTES TRUE)
if(COMPILER_SUPPORTS_ELFNOTES)
set(SDL_DISABLE_DLOPEN_NOTES FALSE)
set(HAVE_DLOPEN_NOTES TRUE)
endif()
endif()
@@ -2708,13 +2718,6 @@ elseif(APPLE)
set(SDL_VIDEO_RENDER_METAL 1)
set(HAVE_RENDER_METAL TRUE)
endif()
if (SDL_GPU)
set(SDL_GPU_METAL 1)
sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/gpu/metal/*.m"
"${SDL3_SOURCE_DIR}/src/gpu/metal/*.h"
)
endif()
endif()
endif()
endif()
@@ -3231,6 +3234,7 @@ elseif(PS2)
gskit
dmakit
ps2_drivers
atomic
)
elseif(N3DS)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/n3ds/*.c")
@@ -3527,6 +3531,14 @@ if(SDL_GPU)
set(SDL_GPU_VULKAN 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_VIDEO_METAL)
sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/gpu/metal/*.m"
"${SDL3_SOURCE_DIR}/src/gpu/metal/*.h"
)
set(SDL_GPU_METAL 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_RENDER_GPU AND HAVE_SDL_GPU)
set(SDL_VIDEO_RENDER_GPU 1)
set(HAVE_RENDER_GPU TRUE)
@@ -3980,6 +3992,7 @@ if(SDL_SHARED)
)
endif()
endif()
target_link_libraries(SDL3-shared PRIVATE ${SDL_CMAKE_DEPENDS})
target_include_directories(SDL3-shared
PRIVATE
@@ -3997,6 +4010,8 @@ if(SDL_SHARED)
set_property(TARGET SDL3-shared PROPERTY INTERFACE_SDL3_SHARED TRUE)
set_property(TARGET SDL3-shared APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION")
set_property(TARGET SDL3-shared PROPERTY INTERFACE_SDL_VERSION "SDL${SDL3_VERSION_MAJOR}")
set_property(TARGET SDL3-shared APPEND PROPERTY EXPORT_PROPERTIES "SDL_FULL_VERSION")
set_property(TARGET SDL3-shared PROPERTY SDL_FULL_VERSION "${PROJECT_VERSION}")
if(NOT CMAKE_VERSION VERSION_LESS "3.16")
target_precompile_headers(SDL3-shared PRIVATE "$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:${PROJECT_SOURCE_DIR}/src/SDL_internal.h>")
endif()
@@ -4021,6 +4036,8 @@ if(SDL_STATIC)
set_property(TARGET SDL3-static PROPERTY INTERFACE_SDL3_SHARED FALSE)
set_property(TARGET SDL3-static APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION")
set_property(TARGET SDL3-static PROPERTY INTERFACE_SDL_VERSION "SDL${SDL3_VERSION_MAJOR}")
set_property(TARGET SDL3-static APPEND PROPERTY EXPORT_PROPERTIES "SDL_FULL_VERSION")
set_property(TARGET SDL3-static PROPERTY SDL_FULL_VERSION "${PROJECT_VERSION}")
if(NOT CMAKE_VERSION VERSION_LESS "3.16")
target_precompile_headers(SDL3-static PRIVATE "$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:${PROJECT_SOURCE_DIR}/src/SDL_internal.h>")
endif()
@@ -4036,7 +4053,7 @@ sdl_compile_definitions(
##### Tests #####
if(SDL_TEST_LIBRARY)
file(GLOB TEST_SOURCES "${SDL3_SOURCE_DIR}/src/test/*.c")
file(GLOB TEST_SOURCES "${SDL3_SOURCE_DIR}/src/test/*.c" "${SDL3_SOURCE_DIR}/src/test/*.h")
target_sources(SDL3_test PRIVATE ${TEST_SOURCES})
if(APPLE)
set_target_properties(SDL3_test PROPERTIES

View File

@@ -1,4 +1,4 @@
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -469,6 +469,7 @@
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_report_descriptor.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
@@ -744,6 +745,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_lg4ff.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_zuiki.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_report_descriptor.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c" />

View File

@@ -88,6 +88,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_lg4ff.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_zuiki.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_report_descriptor.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c" />
@@ -372,6 +373,7 @@
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_report_descriptor.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />

View File

@@ -195,6 +195,9 @@
<TreatWarningAsError>$(TreatWarningsAsError)</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_internal.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
<ClCompile Include="..\..\src\test\SDL_test_common.c" />

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -291,9 +291,8 @@ static void DrawSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
SDL_RenderPresent(renderer);
}
static void loop()
static void update()
{
int i;
SDL_Event event;
/* Check for events */
@@ -310,20 +309,39 @@ static void loop()
SDLTest_CommonEvent(state, &event, &done);
#endif
}
fillerup();
}
static void draw()
{
int i;
for (i = 0; i < state->num_windows; ++i) {
if (state->windows[i] == NULL) {
continue;
}
DrawSprites(state->renderers[i], sprites[i]);
}
fillerup();
}
static bool SDLCALL GDKEventWatch(void* userdata, SDL_Event* event)
{
bool *suppressdraw = (bool *)userdata;
SDL_assert(suppressdraw != NULL);
if (event->type == SDL_EVENT_DID_ENTER_BACKGROUND) {
*suppressdraw = true;
SDL_GDKSuspendComplete();
} else if (event->type == SDL_EVENT_WILL_ENTER_FOREGROUND) {
*suppressdraw = false;
}
return true;
}
int main(int argc, char *argv[])
{
int i;
const char *icon = "icon.bmp";
const char *icon = "icon.png";
char *soundname = NULL;
bool suppressdraw = false;
/* Initialize parameters */
num_sprites = NUM_SPRITES;
@@ -390,6 +408,9 @@ int main(int argc, char *argv[])
quit(2);
}
/* By this point the renderers are made, so we can now add this watcher */
SDL_AddEventWatch(GDKEventWatch, &suppressdraw);
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
@@ -441,7 +462,10 @@ int main(int argc, char *argv[])
AddUserSilent();
while (!done) {
loop();
update();
if (!suppressdraw) {
draw();
}
}
quit(0);

View File

@@ -383,6 +383,7 @@
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_report_descriptor.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
@@ -635,6 +636,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_lg4ff.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_zuiki.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_report_descriptor.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c" />

View File

@@ -675,6 +675,9 @@
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h">
<Filter>joystick\hidapi</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\hidapi\SDL_report_descriptor.h">
<Filter>joystick\hidapi</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h">
<Filter>joystick\windows</Filter>
</ClInclude>
@@ -1305,6 +1308,9 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_report_descriptor.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c">
<Filter>joystick\windows</Filter>
</ClCompile>

View File

@@ -161,6 +161,9 @@
<TreatWarningAsError>$(TreatWarningsAsError)</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_internal.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
<ClCompile Include="..\..\src\test\SDL_test_common.c" />

View File

@@ -7,44 +7,97 @@ This is a list of major changes in SDL's version history.
General:
* Added SDL_CreateAnimatedCursor() to create animated color cursors
* Added SDL_HINT_MOUSE_DPI_SCALE_CURSORS to automatically scale cursors based on the display scale
* Added SDL_SetWindowProgressState(), SDL_SetWindowProgressValue(), SDL_GetWindowProgressState(), and SDL_GetWindowProgressValue() to show progress in the window's taskbar icon on Windows and Linux
* Added SDL_GetGPUDeviceProperties() to get the properties of an SDL GPU device
* Added GPU device creation properties to enable the GPU API on older hardware if you're not using these features:
- SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN
- SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN
- SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN
- SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN
- SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN
* Added SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER to enable configuring Vulkan features when creating a GPU device
* Added SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN to allow requiring Vulkan hardware acceleration when creating a GPU device
* Added SDL_GetGPUDeviceProperties() to query information from a GPU device:
- SDL_PROP_GPU_DEVICE_NAME_STRING
- SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING
- SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING
- SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING
* Added SDL_GetPixelFormatFromGPUTextureFormat() and SDL_GetGPUTextureFormatFromPixelFormat()
* Added SDL_CreateGPURenderer() and SDL_GetGPURendererDevice() to create a 2D renderer for use with GPU rendering.
* Added SDL_CreateGPURenderState(), SDL_SetGPURenderStateFragmentUniforms(), SDL_SetGPURenderState(), and SDL_DestroyGPURenderState() to use fragment shaders with a GPU 2D renderer
* Added SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER to create a 2D texture from an existing GPU texture
* Added SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER to get the GPU texture from a 2D texture when using the GPU 2D renderer
* Added support for YUV textures and HDR colorspaces to the GPU 2D renderer
* Added support for textures with palettes, and SDL_GetTexturePalette() and SDL_SetTexturePalette() to interact with them
* Added SDL_RenderTexture9GridTiled() to do tiled instead of stretched 9-grid texture rendering
* Added SDL_GetDefaultTextureScaleMode() and SDL_SetDefaultTextureScaleMode() to set the texture scale mode for new textures
* Added SDL_GetRenderTextureAddressMode() and SDL_SetRenderTextureAddressMode() to change the texture addressing mode
* Added SDL_TEXTURE_ADDRESS_WRAP to allow wrapping of textures if the renderer has SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN set
* The default YUV colorspace is BT.601 limited range, for compatibility with SDL2
* Added SDL_SCALEMODE_PIXELART as an improved scaling algorithm for pixel art without introducing blurring
* Added SDL_FLIP_HORIZONTAL_AND_VERTICAL to flip a surface both horizontally and vertically
* Added SDL_LoadPNG(), SDL_LoadPNG_IO(), SDL_SavePNG(), and SDL_SavePNG_IO() to load and save PNG images
* Added SDL_LoadSurface() and SDL_LoadSurface_IO() to detect BMP and PNG formats and load them as surfaces
* Added SDL_PROP_SURFACE_ROTATION_FLOAT to indicate the rotation needed to display camera images upright
* Added SDL_RotateSurface() to create a rotated copy of a surface
* SDL_EVENT_WINDOW_EXPOSED now sets data1 to true if it is sent during live resizing
* Added SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED, which is sent when the usable desktop bounds change
* Added SDL_EVENT_SCREEN_KEYBOARD_SHOWN, which is sent when the on-screen keyboard has been shown
* Added SDL_EVENT_SCREEN_KEYBOARD_HIDDEN, which is sent when the on-screen keyboard has been hidden
* Added pinch gesture events: SDL_EVENT_PINCH_BEGIN, SDL_EVENT_PINCH_UPDATE, SDL_EVENT_PINCH_END
* SDL_EVENT_AUDIO_DEVICE_ADDED will be sent during initialization for each audio device
* SDL_GetCameraPermissionState() returns SDL_CameraPermissionState instead of int
* Added SDL_PutAudioStreamDataNoCopy() to do more efficient audio stream processing in some cases
* Added SDL_PutAudioStreamPlanarData() to add planar audio data instead of interleaved data to an audio stream
* Added SDL_HINT_AUDIO_DEVICE_RAW_STREAM to signal that the OS shouldn't do further audio processing, useful for applications that handle noise canceling, etc.
* Added SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN to allow streams that persist beyond the audio subsystem lifetime.
* Added enhanced support for 8BitDo controllers
* Added enhanced support for FlyDigi controllers
* Added enhanced support for Hand Held Legend SInput controllers
* Added support for wired Nintendo Switch 2 controllers when built with libusb
* Added SDL_hid_get_properties() to associate SDL properties with HID devices
* Added SDL_PROP_HIDAPI_LIBUSB_DEVICE_HANDLE_POINTER to query the libusb handle from an SDL_hid_device, if it's been opened with libusb
* Added SDL_SetRelativeMouseTransform() to add custom mouse input transformation
* Added SDL_GetPenDeviceType() to determine whether a pen is on the screen or on a separate touchpad
* SDL_HINT_MAIN_CALLBACK_RATE may be set to a floating point callback rate
* Added SDL_GetEventDescription() to get an English description of an event, suitable for logging
* Added SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER to allow custom freeing of the memory used by SDL_IOFromMem() and SDL_IOFromConstMem()
* Added SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRING to set the working directory for new processes
* Added verbose log output when the DEBUG_INVOCATION environment variable is set to "1"
* Added SDL_AddAtomicU32()
* Added SDL_GetSystemPageSize() to get the system page size
* Added SDL_ALIGNED() to signal that data should have a specific alignment
Windows:
* Added SDL_HINT_RENDER_DIRECT3D11_WARP to enable D3D11 software rasterization
* Using SDL_InsertGPUDebugLabel(), SDL_PushGPUDebugGroup(), and SDL_PopGPUDebugGroup() requires WinPixEventRuntime.dll to be in your PATH or in the same directory as your executable
* Added SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER so you can query the HMONITOR associated with a display
* SDL_HINT_AUDIO_DEVICE_STREAM_ROLE is used by the WASAPI audio driver to set the audio stream category
* Added SDL_HINT_AUDIO_DEVICE_RAW_STREAM to signal whether the OS audio driver should do additional signal processing
* Added SDL_HINT_WINDOWS_RAW_KEYBOARD_EXCLUDE_HOTKEYS to allow disabling some system hotkeys when in raw input mode
* SDL_HINT_WINDOWS_GAMEINPUT is disabled by default
macOS:
* Added SDL_HINT_MAC_PRESS_AND_HOLD to control whether holding down a key will repeat the pressed key or open the accents menu
Linux:
* Added atomic support for KMSDRM
* Added SDL_HINT_KMSDRM_ATOMIC to control whether KMSDRM will use atomic functionality
* Added SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER so you can query the wl_output associated with a display
Emscripten:
* Added SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT for applications that don't want to be fullscreen, but would like to fill the window
* Added SDL_WINDOW_FILL_DOCUMENT to indicate that windows expand to fill the whole browser window
* Added SDL_SetWindowFillDocument() to change whether windows expand to fill the whole browser window
* Added SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING to allow setting the SDL canvas ID, and SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING to query it on existing windows
* Added SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING to specify where keyboard input is bound, and SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING to query it on existing windows
iOS:
* SDL now supports window scenes, fixing the warning "CLIENT OF UIKIT REQUIRES UPDATE"
* Added SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER to specify the window scene for a window
visionOS:
* The default refresh rate has been increased to 90Hz
* SDL_SetWindowSize() changes the size of the window on Vision Pro headsets
PlayStation 2:
* Added the following hints to control the display parameters: SDL_HINT_PS2_GS_WIDTH, SDL_HINT_PS2_GS_HEIGHT, SDL_HINT_PS2_GS_PROGRESSIVE, SDL_HINT_PS2_GS_MODE

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.3.4</string>
<string>3.4.12</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>3.3.4</string>
<string>3.4.12</string>
</dict>
</plist>

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 55;
objects = {
/* Begin PBXAggregateTarget section */
@@ -414,8 +414,8 @@
F386F6F02884663E001840AA /* SDL_utils_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F386F6E52884663E001840AA /* SDL_utils_c.h */; };
F386F6F92884663E001840AA /* SDL_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = F386F6E62884663E001840AA /* SDL_utils.c */; };
F388C95528B5F6F700661ECF /* SDL_hidapi_ps3.c in Sources */ = {isa = PBXBuildFile; fileRef = F388C95428B5F6F600661ECF /* SDL_hidapi_ps3.c */; };
F39344CE2E99771B0056986F /* SDL_dlopennote.h in Headers */ = {isa = PBXBuildFile; fileRef = F39344CD2E99771B0056986F /* SDL_dlopennote.h */; settings = {ATTRIBUTES = (Public, ); }; };
F38C72492CEEB1DE000B0A90 /* SDL_hidapi_steam_triton.c in Sources */ = {isa = PBXBuildFile; fileRef = F38C72482CEEB1DE000B0A90 /* SDL_hidapi_steam_triton.c */; };
F39344CE2E99771B0056986F /* SDL_dlopennote.h in Headers */ = {isa = PBXBuildFile; fileRef = F39344CD2E99771B0056986F /* SDL_dlopennote.h */; settings = {ATTRIBUTES = (Public, ); }; };
F395BF6525633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
F395C1932569C68F00942BFF /* SDL_iokitjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F395C1912569C68E00942BFF /* SDL_iokitjoystick_c.h */; };
F395C19C2569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; };
@@ -530,6 +530,10 @@
F3DDCC5B2AFD42B600B0842B /* SDL_video_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DDCC522AFD42B600B0842B /* SDL_video_c.h */; };
F3DDCC5D2AFD42B600B0842B /* SDL_rect_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DDCC542AFD42B600B0842B /* SDL_rect_impl.h */; };
F3E5A6EB2AD5E0E600293D83 /* SDL_properties.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E5A6EA2AD5E0E600293D83 /* SDL_properties.c */; };
F3E6C3932EE9F20000A6B39E /* SDL_report_descriptor.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E6C3922EE9F20000A6B39E /* SDL_report_descriptor.c */; };
F3E6C3942EE9F20000A6B39E /* SDL_hidapi_flydigi.h in Headers */ = {isa = PBXBuildFile; fileRef = F3E6C38F2EE9F20000A6B39E /* SDL_hidapi_flydigi.h */; };
F3E6C3952EE9F20000A6B39E /* SDL_hidapi_sinput.h in Headers */ = {isa = PBXBuildFile; fileRef = F3E6C3902EE9F20000A6B39E /* SDL_hidapi_sinput.h */; };
F3E6C3962EE9F20000A6B39E /* SDL_report_descriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3E6C3912EE9F20000A6B39E /* SDL_report_descriptor.h */; };
F3EFA5ED2D5AB97300BCF22F /* SDL_stb_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3EFA5EA2D5AB97300BCF22F /* SDL_stb_c.h */; };
F3EFA5EE2D5AB97300BCF22F /* stb_image.h in Headers */ = {isa = PBXBuildFile; fileRef = F3EFA5EC2D5AB97300BCF22F /* stb_image.h */; };
F3EFA5EF2D5AB97300BCF22F /* SDL_surface_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3EFA5EB2D5AB97300BCF22F /* SDL_surface_c.h */; };
@@ -998,8 +1002,8 @@
F386F6E52884663E001840AA /* SDL_utils_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_utils_c.h; sourceTree = "<group>"; };
F386F6E62884663E001840AA /* SDL_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_utils.c; sourceTree = "<group>"; };
F388C95428B5F6F600661ECF /* SDL_hidapi_ps3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps3.c; sourceTree = "<group>"; };
F39344CD2E99771B0056986F /* SDL_dlopennote.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_dlopennote.h; sourceTree = "<group>"; };
F38C72482CEEB1DE000B0A90 /* SDL_hidapi_steam_triton.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam_triton.c; sourceTree = "<group>"; };
F39344CD2E99771B0056986F /* SDL_dlopennote.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_dlopennote.h; sourceTree = "<group>"; };
F395BF6425633B2400942BFF /* SDL_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_crc32.c; sourceTree = "<group>"; };
F395C1912569C68E00942BFF /* SDL_iokitjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_iokitjoystick_c.h; sourceTree = "<group>"; };
F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iokitjoystick.c; sourceTree = "<group>"; };
@@ -1113,6 +1117,10 @@
F3DDCC522AFD42B600B0842B /* SDL_video_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video_c.h; sourceTree = "<group>"; };
F3DDCC542AFD42B600B0842B /* SDL_rect_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_impl.h; sourceTree = "<group>"; };
F3E5A6EA2AD5E0E600293D83 /* SDL_properties.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_properties.c; sourceTree = "<group>"; };
F3E6C38F2EE9F20000A6B39E /* SDL_hidapi_flydigi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_flydigi.h; sourceTree = "<group>"; };
F3E6C3902EE9F20000A6B39E /* SDL_hidapi_sinput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_sinput.h; sourceTree = "<group>"; };
F3E6C3912EE9F20000A6B39E /* SDL_report_descriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_report_descriptor.h; sourceTree = "<group>"; };
F3E6C3922EE9F20000A6B39E /* SDL_report_descriptor.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_report_descriptor.c; sourceTree = "<group>"; };
F3EFA5E92D5AB97300BCF22F /* SDL_stb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_stb.c; sourceTree = "<group>"; };
F3EFA5EA2D5AB97300BCF22F /* SDL_stb_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_stb_c.h; sourceTree = "<group>"; };
F3EFA5EB2D5AB97300BCF22F /* SDL_surface_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_surface_c.h; sourceTree = "<group>"; };
@@ -1948,6 +1956,7 @@
children = (
F3395BA72D9A5971007246C8 /* SDL_hidapi_8bitdo.c */,
F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */,
F3E6C38F2EE9F20000A6B39E /* SDL_hidapi_flydigi.h */,
F3395BA72D9A5971007246C9 /* SDL_hidapi_flydigi.c */,
A7D8A7C923E2513E00DCD162 /* SDL_hidapi_gamecube.c */,
F3B6B8092DC3EA54004954FD /* SDL_hidapi_gip.c */,
@@ -1960,6 +1969,7 @@
A75FDBC323EA380300529352 /* SDL_hidapi_rumble.h */,
A75FDBC423EA380300529352 /* SDL_hidapi_rumble.c */,
9846B07B287A9020000C35C8 /* SDL_hidapi_shield.c */,
F3E6C3902EE9F20000A6B39E /* SDL_hidapi_sinput.h */,
02D6A1C128A84B8F00A7F001 /* SDL_hidapi_sinput.c */,
F3984CCF25BCC92800374F43 /* SDL_hidapi_stadia.c */,
A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */,
@@ -1975,6 +1985,8 @@
63124A412E5C357500A53610 /* SDL_hidapi_zuiki.c */,
A7D8A7C423E2513E00DCD162 /* SDL_hidapijoystick.c */,
A7D8A7C723E2513E00DCD162 /* SDL_hidapijoystick_c.h */,
F3E6C3912EE9F20000A6B39E /* SDL_report_descriptor.h */,
F3E6C3922EE9F20000A6B39E /* SDL_report_descriptor.c */,
);
path = hidapi;
sourceTree = "<group>";
@@ -2554,6 +2566,9 @@
F3D46ADB2D20625800D9CBDF /* SDL_pen.h in Headers */,
F3D46ADC2D20625800D9CBDF /* SDL_render.h in Headers */,
F3D46ADD2D20625800D9CBDF /* SDL_assert.h in Headers */,
F3E6C3942EE9F20000A6B39E /* SDL_hidapi_flydigi.h in Headers */,
F3E6C3952EE9F20000A6B39E /* SDL_hidapi_sinput.h in Headers */,
F3E6C3962EE9F20000A6B39E /* SDL_report_descriptor.h in Headers */,
F3D46ADE2D20625800D9CBDF /* SDL_atomic.h in Headers */,
F3D46ADF2D20625800D9CBDF /* SDL_begin_code.h in Headers */,
F3D46AE02D20625800D9CBDF /* SDL_log.h in Headers */,
@@ -2923,6 +2938,7 @@
F3C1BD752D1F1A3000846529 /* SDL_tray_utils.c in Sources */,
F382071D284F362F004DD584 /* SDL_guid.c in Sources */,
A7D8BB8D23E2514500DCD162 /* SDL_touch.c in Sources */,
F3E6C3932EE9F20000A6B39E /* SDL_report_descriptor.c in Sources */,
F31A92D228D4CB39003BFD6A /* SDL_offscreenopengles.c in Sources */,
A1626A3E2617006A003F1973 /* SDL_triangle.c in Sources */,
A7D8B3F223E2514300DCD162 /* SDL_thread.c in Sources */,
@@ -3145,8 +3161,8 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 305.0.0;
DYLIB_CURRENT_VERSION = 305.0.0;
DYLIB_COMPATIBILITY_VERSION = 401.0.0;
DYLIB_CURRENT_VERSION = 401.12.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3181,7 +3197,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.3.4;
MARKETING_VERSION = 3.4.12;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3;
@@ -3211,8 +3227,8 @@
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 305.0.0;
DYLIB_CURRENT_VERSION = 305.0.0;
DYLIB_COMPATIBILITY_VERSION = 401.0.0;
DYLIB_CURRENT_VERSION = 401.12.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -3244,7 +3260,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.3.4;
MARKETING_VERSION = 3.4.12;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;

View File

@@ -1,4 +1,4 @@
Title SDL 3.3.4
Title SDL 3.4.12
Version 1
Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks

View File

@@ -45,10 +45,11 @@
boolean setSystemCursor(int);
void setWindowStyle(boolean);
boolean shouldMinimizeOnFocusLoss();
boolean showFileDialog(java.lang.String[], boolean, boolean, int);
boolean showTextInput(int, int, int, int, int);
boolean supportsRelativeMouse();
int openFileDescriptor(java.lang.String, java.lang.String);
boolean showFileDialog(java.lang.String[], boolean, boolean, int);
boolean showFileDialog(java.lang.String[], boolean, int, java.lang.String, int);
java.lang.String getPreferredLocales();
java.lang.String formatLocale(java.util.Locale);
}
@@ -68,7 +69,9 @@
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager {
void joystickSetSensorsEnabled(int, boolean);
void pollInputDevices();
void joystickSetLED(int, int, int, int);
void pollHapticDevices();
void hapticRun(int, float, int);
void hapticRumble(int, float, float, int);

View File

@@ -19,9 +19,13 @@ import android.os.*;
import java.lang.Runnable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDevice {
private static final String TAG = "hidapi";
@@ -33,10 +37,19 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
private boolean mIsConnected = false;
private boolean mIsChromebook = false;
private boolean mIsReconnecting = false;
private boolean mHasEnabledNotifications = false;
private boolean mHasSeenInputUpdate = false;
private boolean mFrozen = false;
private LinkedList<GattOperation> mOperations;
GattOperation mCurrentOperation = null;
private Handler mHandler;
private int mProductId = -1;
private int mReportId = 0;
private UUID mInputCharacteristic;
private static final int D0G_BLE2_PID = 0x1106;
private static final int TRITON_BLE_PID = 0x1303;
private static final int TRANSPORT_AUTO = 0;
private static final int TRANSPORT_BREDR = 1;
@@ -45,10 +58,14 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
private static final int CHROMEBOOK_CONNECTION_CHECK_INTERVAL = 10000;
static final UUID steamControllerService = UUID.fromString("100F6C32-1735-4313-B402-38567131E5F3");
static final UUID inputCharacteristic = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3");
static final UUID inputCharacteristicD0G = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3");
static final UUID inputCharacteristicTriton_0x45 = UUID.fromString("100F6C7A-1735-4313-B402-38567131E5F3");
static final UUID inputCharacteristicTriton_0x47 = UUID.fromString("100F6C7C-1735-4313-B402-38567131E5F3");
static final UUID reportCharacteristic = UUID.fromString("100F6C34-1735-4313-B402-38567131E5F3");
static private final byte[] enterValveMode = new byte[] { (byte)0xC0, (byte)0x87, 0x03, 0x08, 0x07, 0x00 };
private HashMap<Integer, BluetoothGattCharacteristic> mOutputReportChars = new HashMap<Integer, BluetoothGattCharacteristic>();
static class GattOperation {
private enum Operation {
CHR_READ,
@@ -61,6 +78,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
byte[] mValue;
BluetoothGatt mGatt;
boolean mResult = true;
int mDelayMs = 0;
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid) {
mGatt = gatt;
@@ -68,6 +86,13 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mUuid = uuid;
}
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, int delayMs) {
mGatt = gatt;
mOp = operation;
mUuid = uuid;
mDelayMs = delayMs;
}
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value) {
mGatt = gatt;
mOp = operation;
@@ -75,6 +100,14 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mValue = value;
}
private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value, int delayMs) {
mGatt = gatt;
mOp = operation;
mUuid = uuid;
mValue = value;
mDelayMs = delayMs;
}
public void run() {
// This is executed in main thread
BluetoothGattCharacteristic chr;
@@ -136,6 +169,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
return mResult;
}
public int getDelayMs() { return mDelayMs; }
private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
BluetoothGattService valveService = mGatt.getService(steamControllerService);
if (valveService == null)
@@ -154,6 +189,10 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid) {
return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid);
}
static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid, int delayMs) {
return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid, delayMs);
}
}
HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice device) {
@@ -166,6 +205,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mHandler = new Handler(Looper.getMainLooper());
mGatt = connectGatt();
mHasEnabledNotifications = false;
mHasSeenInputUpdate = false;
// final HIDDeviceBLESteamController finalThis = this;
// mHandler.postDelayed(new Runnable() {
// @Override
@@ -314,8 +355,45 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
Log.v(TAG, "Found Valve steam controller service " + service.getUuid());
for (BluetoothGattCharacteristic chr : service.getCharacteristics()) {
if (chr.getUuid().equals(inputCharacteristic)) {
Log.v(TAG, "Found input characteristic");
if (chr.getUuid().equals(inputCharacteristicTriton_0x45)) {
Log.v(TAG, "Found Triton input characteristic 0x45");
mProductId = TRITON_BLE_PID;
mReportId = 0x45;
mInputCharacteristic = chr.getUuid();
} else if (chr.getUuid().equals(inputCharacteristicTriton_0x47)) {
Log.v(TAG, "Found Triton input characteristic 0x47");
mProductId = TRITON_BLE_PID;
mReportId = 0x47;
mInputCharacteristic = chr.getUuid();
} else if (chr.getUuid().equals(inputCharacteristicD0G)) {
Log.v(TAG, "Found D0G input characteristic");
mProductId = D0G_BLE2_PID;
mReportId = 0x03;
mInputCharacteristic = chr.getUuid();
} else {
Pattern reportPattern = Pattern.compile("100F6C([0-9A-Z]{2})", Pattern.CASE_INSENSITIVE);
Matcher matcher = reportPattern.matcher(chr.getUuid().toString());
if (matcher.find()) {
try {
int reportId = Integer.parseInt(matcher.group(1), 16);
reportId -= 0x35;
if (reportId >= 0x80) {
// This is a Triton output report characteristic that we need to care about.
Log.v(TAG, "Found Triton output report 0x" + Integer.toString(reportId, 16));
mOutputReportChars.put(reportId, chr);
}
}
catch (NumberFormatException nfe) {
Log.w(TAG, "Could not parse report characteristic " + chr.getUuid().toString() + ": " + nfe.toString());
}
}
}
}
for (BluetoothGattCharacteristic chr : service.getCharacteristics()) {
if (chr.getUuid().equals(mInputCharacteristic)) {
// Start notifications
BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"));
if (cccd != null) {
@@ -372,21 +450,30 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mCurrentOperation = mOperations.removeFirst();
}
// Run in main thread
mHandler.post(new Runnable() {
@Override
public void run() {
synchronized (mOperations) {
if (mCurrentOperation == null) {
Log.e(TAG, "Current operation null in executor?");
return;
}
Runnable gattOperationRunnable = new Runnable() {
@Override
public void run() {
synchronized (mOperations) {
if (mCurrentOperation == null) {
Log.e(TAG, "Current operation null in executor?");
return;
}
mCurrentOperation.run();
// now wait for the GATT callback and when it comes, finish this operation
mCurrentOperation.run();
// now wait for the GATT callback and when it comes, finish this operation
}
}
}
});
};
if (mCurrentOperation.getDelayMs() == 0) {
// Run in main thread
mHandler.post(gattOperationRunnable);
}
else {
// If we have a delay on this operation, wait before we post it.
mHandler.postDelayed(gattOperationRunnable, mCurrentOperation.getDelayMs());
}
}
private void queueGattOperation(GattOperation op) {
@@ -397,8 +484,39 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
}
private void enableNotification(UUID chrUuid) {
GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid);
// Add a 500ms delay to notification write for Amazon Fire TV devices, as otherwise if we do this too quickly after connecting
// it will return success and then silently drop the operation on the floor.
GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid, 500);
queueGattOperation(op);
// Amazon Fire devices can also silently timeout on writeDescriptor, so
// set up a little delayed check that will attempt to write a second time.
//
// While this only seems to be needed on Amazon Fire TV devices at present, it
// doesn't hurt to have a retry on other devices as well.
//
final HIDDeviceBLESteamController finalThis = this;
final UUID finalUuid = chrUuid;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (!finalThis.mHasEnabledNotifications) {
if (finalThis.mHasSeenInputUpdate) {
// Amazon Five devices may have enabled notifications on the input characteristic and not given us a callback. If we've seen
// input reports, though, somewhat by definition notifications are enabled.
Log.w(TAG, "WriteDescriptor has never returned, but we've seen input reports. Moving on with controller initialization.");
finalThis.mHasEnabledNotifications = true;
finalThis.enableValveMode();
return;
}
// Give one more try.
GattOperation retry = HIDDeviceBLESteamController.GattOperation.enableNotification(finalThis.mGatt, finalUuid, 500);
finalThis.queueGattOperation(retry);
}
}
}, 1000);
}
void writeCharacteristic(UUID uuid, byte[] value) {
@@ -448,8 +566,16 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mIsConnected = false;
gatt.disconnect();
mGatt = connectGatt(false);
}
else {
} else {
if (getProductId() == TRITON_BLE_PID) {
// Android will not properly play well with Data Length Extensions without manually requesting a large MTU,
// and Triton controllers require DLE support.
//
// 517 is basically a "magic number" as far as Android's bluetooth code is concerned, so do not change
// this value. It is functionally "please enable data length extensions" on some Android builds.
mGatt.requestMtu(517);
}
probeService(this);
}
}
@@ -474,7 +600,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Only register controller with the native side once it has been fully configured
if (!isRegistered()) {
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true);
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true, mReportId);
setRegistered();
}
}
@@ -487,7 +613,8 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Enable this for verbose logging of controller input reports
//Log.v(TAG, "onCharacteristicChanged uuid=" + characteristic.getUuid() + " data=" + HexDump.dumpHexString(characteristic.getValue()));
if (characteristic.getUuid().equals(inputCharacteristic) && !mFrozen) {
if (characteristic.getUuid().equals(mInputCharacteristic) && !mFrozen) {
mHasSeenInputUpdate = true;
mManager.HIDDeviceInputReport(getId(), characteristic.getValue());
}
}
@@ -497,19 +624,36 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
//Log.v(TAG, "onDescriptorRead status=" + status);
}
private void enableValveMode()
{
BluetoothGattService valveService = mGatt.getService(steamControllerService);
if (valveService == null)
return;
BluetoothGattCharacteristic reportChr = valveService.getCharacteristic(reportCharacteristic);
if (reportChr != null) {
if (getProductId() == TRITON_BLE_PID) {
// For Triton we just mark things registered.
Log.v(TAG, "Registering Triton Steam Controller with ID: " + getId());
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0, true, mReportId);
setRegistered();
} else {
// For the original controller, we need to manually enter Valve mode.
Log.v(TAG, "Writing report characteristic to enter valve mode");
reportChr.setValue(enterValveMode);
mGatt.writeCharacteristic(reportChr);
}
}
}
@Override
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
BluetoothGattCharacteristic chr = descriptor.getCharacteristic();
//Log.v(TAG, "onDescriptorWrite status=" + status + " uuid=" + chr.getUuid() + " descriptor=" + descriptor.getUuid());
if (chr.getUuid().equals(inputCharacteristic)) {
boolean hasWrittenInputDescriptor = true;
BluetoothGattCharacteristic reportChr = chr.getService().getCharacteristic(reportCharacteristic);
if (reportChr != null) {
Log.v(TAG, "Writing report characteristic to enter valve mode");
reportChr.setValue(enterValveMode);
gatt.writeCharacteristic(reportChr);
}
if (chr.getUuid().equals(mInputCharacteristic)) {
mHasEnabledNotifications = true;
enableValveMode();
}
finishCurrentGattOperation();
@@ -548,9 +692,20 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
@Override
public int getProductId() {
// We don't have an easy way to query from the Bluetooth device, but we know what it is
final int D0G_BLE2_PID = 0x1106;
return D0G_BLE2_PID;
if (mProductId > 0) {
// We've already set a product ID.
return mProductId;
}
if (mDevice.getName().startsWith("Steam Ctrl")) {
// We're a newer Triton device
mProductId = TRITON_BLE_PID;
} else {
// We're an OG Steam Controller
mProductId = D0G_BLE2_PID;
}
return mProductId;
}
@Override
@@ -601,10 +756,29 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
writeCharacteristic(reportCharacteristic, actual_report);
return report.length;
} else {
//Log.v(TAG, "writeOutputReport " + HexDump.dumpHexString(report));
writeCharacteristic(reportCharacteristic, report);
return report.length;
// If we're an original-recipe Steam Controller we just write to the characteristic directly.
if (getProductId() == D0G_BLE2_PID) {
//Log.v(TAG, "writeOutputReport " + HexDump.dumpHexString(report));
writeCharacteristic(reportCharacteristic, report);
return report.length;
}
// If we're a Triton, we need to find the correct report characteristic.
if (report.length > 0) {
int reportId = report[0] & 0xFF;
BluetoothGattCharacteristic targetedReportCharacteristic = mOutputReportChars.get(reportId);
if (targetedReportCharacteristic != null) {
byte[] actual_report = Arrays.copyOfRange(report, 1, report.length - 1);
//Log.v(TAG, "writeOutputReport 0x" + Integer.toString(reportId, 16) + " " + HexDump.dumpHexString(report));
writeCharacteristic(targetedReportCharacteristic.getUuid(), actual_report);
return report.length;
} else {
Log.w(TAG, "Got report write request for unknown report type 0x" + Integer.toString(reportId, 16));
}
}
}
return -1;
}
@Override

View File

@@ -256,6 +256,8 @@ public class HIDDeviceManager {
0x24c6, // PowerA
0x2c22, // Qanba
0x2dc8, // 8BitDo
0x3537, // GameSir
0x37d7, // Flydigi
0x9886, // ASTRO Gaming
};
@@ -359,7 +361,7 @@ public class HIDDeviceManager {
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_index);
int id = device.getId();
mDevicesById.put(id, device);
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol(), false);
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol(), false, 0);
}
}
}
@@ -528,7 +530,13 @@ public class HIDDeviceManager {
return false;
}
return bluetoothDevice.getName().equals("SteamController") && ((bluetoothDevice.getType() & BluetoothDevice.DEVICE_TYPE_LE) != 0);
// Steam Controllers will always support Bluetooth Low Energy
if ((bluetoothDevice.getType() & BluetoothDevice.DEVICE_TYPE_LE) == 0) {
return false;
}
// Match on the name either the original Steam Controller or the new second-generation one advertise with.
return bluetoothDevice.getName().equals("SteamController") || bluetoothDevice.getName().startsWith("Steam Ctrl");
}
private void close() {
@@ -680,7 +688,7 @@ public class HIDDeviceManager {
private native void HIDDeviceRegisterCallback();
private native void HIDDeviceReleaseCallback();
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol, boolean bBluetooth);
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol, boolean bBluetooth, int reportID);
native void HIDDeviceOpenPending(int deviceID);
native void HIDDeviceOpenResult(int deviceID, boolean opened);
native void HIDDeviceDisconnected(int deviceID);

View File

@@ -21,6 +21,7 @@ class HIDDeviceUSB implements HIDDevice {
protected InputThread mInputThread;
protected boolean mRunning;
protected boolean mFrozen;
protected boolean mClaimed;
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) {
mManager = manager;
@@ -29,6 +30,7 @@ class HIDDeviceUSB implements HIDDevice {
mInterface = mDevice.getInterface(mInterfaceIndex).getId();
mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier());
mRunning = false;
mClaimed = false;
}
String getIdentifier() {
@@ -56,7 +58,7 @@ class HIDDeviceUSB implements HIDDevice {
try {
result = mDevice.getSerialNumber();
}
catch (SecurityException exception) {
catch (Exception exception) {
//Log.w(TAG, "App permissions mean we cannot get serial number for device " + getDeviceName() + " message: " + exception.getMessage());
}
if (result == null) {
@@ -114,6 +116,7 @@ class HIDDeviceUSB implements HIDDevice {
close();
return false;
}
mClaimed = true;
// Find the endpoints
for (int j = 0; j < iface.getEndpointCount(); j++) {
@@ -132,9 +135,12 @@ class HIDDeviceUSB implements HIDDevice {
}
}
// Make sure the required endpoints were present
if (mInputEndpoint == null || mOutputEndpoint == null) {
// Make sure the required endpoints were present. The original Steam Controller and the wireless dongle for it do NOT
// actually have -- or require -- output endpoints, so we need to accept only an input one for them or else we'll fall
// back to the Android system gamepad functionality (and lose our paddles et al).
if (mInputEndpoint == null) {
Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName());
mConnection.releaseInterface(iface);
close();
return false;
}
@@ -154,6 +160,11 @@ class HIDDeviceUSB implements HIDDevice {
return -1;
}
if (!mClaimed) {
Log.w(TAG, "writeReport() called but some other process currently owns the USB device");
return -1;
}
if (feature) {
int res = -1;
int offset = 0;
@@ -185,6 +196,11 @@ class HIDDeviceUSB implements HIDDevice {
}
return length;
} else {
if (mOutputEndpoint == null)
{
Log.e(TAG, "Tried to write an output report to an interface with no output endpoint!");
return -1;
}
int res = mConnection.bulkTransfer(mOutputEndpoint, report, report.length, 1000);
if (res != report.length) {
Log.w(TAG, "writeOutputReport() returned " + res + " on device " + getDeviceName());
@@ -205,6 +221,12 @@ class HIDDeviceUSB implements HIDDevice {
Log.w(TAG, "readReport() called with no device connection");
return false;
}
if (!mClaimed) {
if (feature) {
return false;
}
return true;
}
if (report_number == 0x0) {
/* Offset the return buffer by 1, so that the report ID
@@ -258,10 +280,13 @@ class HIDDeviceUSB implements HIDDevice {
mInputThread = null;
}
if (mConnection != null) {
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
mConnection.releaseInterface(iface);
if (mClaimed) {
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
mConnection.releaseInterface(iface);
}
mConnection.close();
mConnection = null;
mClaimed = false;
}
}
@@ -274,6 +299,22 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public void setFrozen(boolean frozen) {
mFrozen = frozen;
/* If we have a valid device connection and the claim state doesn't match what we want, try to correct that. */
if (mConnection != null && mClaimed == mFrozen) {
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
if (frozen) {
mClaimed = !mConnection.releaseInterface(iface);
if (mClaimed) {
Log.e(TAG, "Tried to release claim on USB device, but failed!");
}
} else {
mClaimed = mConnection.claimInterface(iface, true);
if (!mClaimed) {
Log.e(TAG, "Tried to regain claim on USB device, but failed!");
}
}
}
}
protected class InputThread extends Thread {

View File

@@ -60,8 +60,8 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 3;
private static final int SDL_MICRO_VERSION = 4;
private static final int SDL_MINOR_VERSION = 4;
private static final int SDL_MICRO_VERSION = 12;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -530,7 +530,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(true);
}
}
if (!mHasMultiWindow) {
pauseNativeThread();
}
@@ -543,7 +544,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(false);
}
}
if (!mHasMultiWindow) {
resumeNativeThread();
}
@@ -570,7 +572,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static int getNaturalOrientation() {
int result = SDL_ORIENTATION_UNKNOWN;
Activity activity = (Activity)getContext();
Activity activity = getContext();
if (activity != null) {
Configuration config = activity.getResources().getConfiguration();
Display display = activity.getWindowManager().getDefaultDisplay();
@@ -590,7 +592,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static int getCurrentRotation() {
int result = 0;
Activity activity = (Activity)getContext();
Activity activity = getContext();
if (activity != null) {
Display display = activity.getWindowManager().getDefaultDisplay();
switch (display.getRotation()) {
@@ -616,6 +618,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
super.onWindowFocusChanged(hasFocus);
Log.v(TAG, "onWindowFocusChanged(): " + hasFocus);
// If we are gaining focus, we can always try to restore our USB devices. If we are losing focus,
// only try to relinquish them if we don't have background events allowed (for multi-window Android setups).
if (hasFocus || !SDLActivity.nativeGetHintBoolean("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", false)) {
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(!hasFocus);
}
}
if (SDLActivity.mBrokenLibraries) {
return;
}
@@ -1270,10 +1280,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (Build.MANUFACTURER.equals("MINIX") && Build.MODEL.equals("NEO-U1")) {
return true;
}
if (Build.MANUFACTURER.equals("Amlogic") && Build.MODEL.equals("X96-W")) {
return true;
}
if (Build.MANUFACTURER.equals("Amlogic") && Build.MODEL.startsWith("TV")) {
if (Build.MANUFACTURER.equals("Amlogic") &&
(Build.MODEL.startsWith("TV") ||
Build.MODEL.equals("X96-W") ||
Build.MODEL.equals("A95X-R1"))) {
return true;
}
return false;
@@ -1292,7 +1302,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static double getDiagonal()
{
DisplayMetrics metrics = new DisplayMetrics();
Activity activity = (Activity)getContext();
Activity activity = getContext();
if (activity == null) {
return 0.0;
}
@@ -1481,11 +1491,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
// Note that we process events with specific key codes here
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (SDLControllerManager.onNativePadDown(deviceId, keyCode)) {
if (SDLControllerManager.onNativePadDown(deviceId, keyCode, event.getScanCode())) {
return true;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (SDLControllerManager.onNativePadUp(deviceId, keyCode)) {
if (SDLControllerManager.onNativePadUp(deviceId, keyCode, event.getScanCode())) {
return true;
}
}
@@ -1940,7 +1950,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return;
}
Activity activity = (Activity)getContext();
Activity activity = getContext();
if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
activity.requestPermissions(new String[]{permission}, requestCode);
} else {
@@ -1963,7 +1973,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY
| Intent.FLAG_ACTIVITY_MULTIPLE_TASK
| Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
i.addFlags(flags);

View File

@@ -6,6 +6,15 @@ import java.util.Comparator;
import java.util.List;
import android.content.Context;
import android.hardware.lights.Light;
import android.hardware.lights.LightsRequest;
import android.hardware.lights.LightsManager;
import android.hardware.lights.LightState;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.graphics.Color;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;
@@ -25,16 +34,18 @@ public class SDLControllerManager
static native void nativeAddJoystick(int device_id, String name, String desc,
int vendor_id, int product_id,
int button_mask,
int naxes, int axis_mask, int nhats, boolean can_rumble);
int naxes, int axis_mask, int nhats, boolean can_rumble, boolean has_rgb_led,
boolean has_accelerometer, boolean has_gyroscope);
static native void nativeRemoveJoystick(int device_id);
static native void nativeAddHaptic(int device_id, String name);
static native void nativeRemoveHaptic(int device_id);
static public native boolean onNativePadDown(int device_id, int keycode);
static public native boolean onNativePadUp(int device_id, int keycode);
static public native boolean onNativePadDown(int device_id, int keycode, int scancode);
static public native boolean onNativePadUp(int device_id, int keycode, int scancode);
static native void onNativeJoy(int device_id, int axis,
float value);
static native void onNativeHat(int device_id, int hat_id,
int x, int y);
static native void onNativeJoySensor(int device_id, int sensor_type, long sensor_timestamp, float x, float y, float z);
protected static SDLJoystickHandler mJoystickHandler;
protected static SDLHapticHandler mHapticHandler;
@@ -69,6 +80,20 @@ public class SDLControllerManager
mJoystickHandler.pollInputDevices();
}
/**
* This method is called by SDL using JNI.
*/
static void joystickSetLED(int device_id, int red, int green, int blue) {
mJoystickHandler.setLED(device_id, red, green, blue);
}
/**
* This method is called by SDL using JNI.
*/
static void joystickSetSensorsEnabled(int device_id, boolean enabled) {
mJoystickHandler.setSensorsEnabled(device_id, enabled);
}
/**
* This method is called by SDL using JNI.
*/
@@ -139,6 +164,12 @@ class SDLJoystickHandler {
String desc;
ArrayList<InputDevice.MotionRange> axes;
ArrayList<InputDevice.MotionRange> hats;
ArrayList<Light> lights;
LightsManager.LightsSession lightsSession;
SensorManager sensorManager;
SDLJoySensorListener sensorListener;
Sensor accelerometerSensor;
Sensor gyroscopeSensor;
}
static class RangeComparator implements Comparator<InputDevice.MotionRange> {
@Override
@@ -197,7 +228,7 @@ class SDLJoystickHandler {
/**
* Handles adding and removing of input devices.
*/
void pollInputDevices() {
synchronized void pollInputDevices() {
int[] deviceIds = InputDevice.getDeviceIds();
for (int device_id : deviceIds) {
@@ -211,11 +242,13 @@ class SDLJoystickHandler {
joystick.desc = getJoystickDescriptor(joystickDevice);
joystick.axes = new ArrayList<InputDevice.MotionRange>();
joystick.hats = new ArrayList<InputDevice.MotionRange>();
java.util.Set<Integer> axisStrsSet = new java.util.HashSet<Integer>();
joystick.lights = new ArrayList<Light>();
List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
Collections.sort(ranges, new RangeComparator());
for (InputDevice.MotionRange range : ranges) {
if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
if (((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) && axisStrsSet.add(range.getAxis())) {
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
joystick.hats.add(range);
} else {
@@ -225,18 +258,46 @@ class SDLJoystickHandler {
}
boolean can_rumble = false;
boolean has_rgb_led = false;
boolean has_accelerometer = false;
boolean has_gyroscope = false;
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
VibratorManager manager = joystickDevice.getVibratorManager();
int[] vibrators = manager.getVibratorIds();
VibratorManager vibratorManager = joystickDevice.getVibratorManager();
int[] vibrators = vibratorManager.getVibratorIds();
if (vibrators.length > 0) {
can_rumble = true;
}
LightsManager lightsManager = joystickDevice.getLightsManager();
List<Light> lights = lightsManager.getLights();
for (Light light : lights) {
if (light.hasRgbControl()) {
joystick.lights.add(light);
}
}
if (!joystick.lights.isEmpty()) {
joystick.lightsSession = lightsManager.openSession();
has_rgb_led = true;
}
SensorManager sensorManager = joystickDevice.getSensorManager();
if (sensorManager != null) {
joystick.sensorManager = sensorManager;
joystick.sensorListener = new SDLJoySensorListener(joystick.device_id);
joystick.accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
if (joystick.accelerometerSensor != null) {
has_accelerometer = true;
}
joystick.gyroscopeSensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
if (joystick.gyroscopeSensor != null) {
has_gyroscope = true;
}
}
}
mJoysticks.add(joystick);
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
getVendorId(joystickDevice), getProductId(joystickDevice),
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, can_rumble);
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, can_rumble, has_rgb_led,
has_accelerometer, has_gyroscope);
}
}
}
@@ -262,6 +323,16 @@ class SDLJoystickHandler {
SDLControllerManager.nativeRemoveJoystick(device_id);
for (int i = 0; i < mJoysticks.size(); i++) {
if (mJoysticks.get(i).device_id == device_id) {
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
if (mJoysticks.get(i).lightsSession != null) {
try {
mJoysticks.get(i).lightsSession.close();
} catch (Exception e) {
// Session may already be unregistered when device disconnects
}
mJoysticks.get(i).lightsSession = null;
}
}
mJoysticks.remove(i);
break;
}
@@ -270,7 +341,7 @@ class SDLJoystickHandler {
}
}
protected SDLJoystick getJoystick(int device_id) {
synchronized protected SDLJoystick getJoystick(int device_id) {
for (SDLJoystick joystick : mJoysticks) {
if (joystick.device_id == device_id) {
return joystick;
@@ -453,6 +524,49 @@ class SDLJoystickHandler {
}
return button_mask;
}
void setLED(int device_id, int red, int green, int blue) {
if (Build.VERSION.SDK_INT < 31 /* Android 12.0 (S) */) {
return;
}
SDLJoystick joystick = getJoystick(device_id);
if (joystick == null || joystick.lights.isEmpty()) {
return;
}
LightsRequest.Builder lightsRequest = new LightsRequest.Builder();
LightState lightState = new LightState.Builder().setColor(Color.rgb(red, green, blue)).build();
for (Light light : joystick.lights) {
if (light.hasRgbControl()) {
lightsRequest.addLight(light, lightState);
}
}
joystick.lightsSession.requestLights(lightsRequest.build());
}
void setSensorsEnabled(int device_id, boolean enabled) {
if (Build.VERSION.SDK_INT < 31 /* Android 12.0 (S) */) {
return;
}
SDLJoystick joystick = getJoystick(device_id);
if (joystick == null || joystick.sensorManager == null) {
return;
}
if (enabled) {
if (joystick.accelerometerSensor != null) {
SDLSensorManager.registerListener(joystick.sensorManager, joystick.sensorListener, joystick.accelerometerSensor, SensorManager.SENSOR_DELAY_GAME);
}
if (joystick.gyroscopeSensor != null) {
SDLSensorManager.registerListener(joystick.sensorManager, joystick.sensorListener, joystick.gyroscopeSensor, SensorManager.SENSOR_DELAY_GAME);
}
} else {
if (joystick.accelerometerSensor != null) {
SDLSensorManager.unregisterListener(joystick.sensorManager, joystick.sensorListener, joystick.accelerometerSensor);
}
if (joystick.gyroscopeSensor != null) {
SDLSensorManager.unregisterListener(joystick.sensorManager, joystick.sensorListener, joystick.gyroscopeSensor);
}
}
}
}
class SDLHapticHandler_API31 extends SDLHapticHandler {
@@ -587,7 +701,7 @@ class SDLHapticHandler {
}
}
void pollHapticDevices() {
synchronized void pollHapticDevices() {
final int deviceId_VIBRATOR_SERVICE = 999999;
boolean hasVibratorService = false;
@@ -635,7 +749,7 @@ class SDLHapticHandler {
}
}
protected SDLHaptic getHaptic(int device_id) {
synchronized protected SDLHaptic getHaptic(int device_id) {
for (SDLHaptic haptic : mHaptics) {
if (haptic.device_id == device_id) {
return haptic;
@@ -700,6 +814,9 @@ class SDLGenericMotionListener_API14 implements View.OnGenericMotionListener {
// BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4, and apply SDL_PEN_INPUT_DOWN/SDL_PEN_INPUT_ERASER_TIP
int buttons = (event.getButtonState() >> 4) | (1 << (toolType == MotionEvent.TOOL_TYPE_STYLUS ? 0 : 30));
if ((event.getButtonState() & MotionEvent.BUTTON_TERTIARY) != 0) {
buttons |= 0x08;
}
SDLActivity.onNativePen(event.getPointerId(i), getPenDeviceType(event.getDevice()), buttons, action, x, y, p);
consumed = true;
@@ -875,3 +992,19 @@ class SDLGenericMotionListener_API29 extends SDLGenericMotionListener_API26 {
return penDevice.isExternal() ? SDL_PEN_DEVICE_TYPE_INDIRECT : SDL_PEN_DEVICE_TYPE_DIRECT;
}
}
class SDLJoySensorListener implements SensorEventListener {
int device_id;
public SDLJoySensorListener(int device_id) {
this.device_id = device_id;
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
@Override
public void onSensorChanged(SensorEvent event) {
SDLControllerManager.onNativeJoySensor(device_id, event.sensor.getType(), event.timestamp, event.values[0], event.values[1], event.values[2]);
}
}

View File

@@ -65,17 +65,15 @@ class SDLInputConnection extends BaseInputConnection
@Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
if (beforeLength > 0 && afterLength == 0) {
// backspace(s)
while (beforeLength-- > 0) {
nativeGenerateScancodeForUnichar('\b');
}
return true;
}
}
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
if (beforeLength > 0 && afterLength == 0) {
// backspace(s)
while (beforeLength-- > 0) {
nativeGenerateScancodeForUnichar('\b');
}
return true;
}
if (!super.deleteSurroundingText(beforeLength, afterLength)) {
return false;

View File

@@ -0,0 +1,73 @@
package org.libsdl.app;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
// This class coordinates synchronized access to sensor manager registration
//
// This prevents a java.util.ConcurrentModificationException exception on
// Android 16, specifically on the Samsung Tab S9 Ultra.
class SDLSensorManager
{
static private SDLSensorManager mManager = new SDLSensorManager();
static final int RETRY_COUNT = 3;
public static void registerListener(SensorManager manager, SensorEventListener listener, Sensor sensor, int samplingPeriodUs) {
mManager.RegisterListener(manager, listener, sensor, samplingPeriodUs);
}
public static void unregisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor) {
mManager.UnregisterListener(manager, listener, sensor);
}
private synchronized void RegisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor, int samplingPeriodUs) {
int retries = 0;
boolean complete = false;
while (!complete) {
try {
manager.registerListener(listener, sensor, samplingPeriodUs, null);
complete = true;
} catch (java.util.ConcurrentModificationException e) {
++retries;
if (retries <= RETRY_COUNT) {
// Sleep a bit and try again
try {
Thread.sleep(1);
} catch (Exception e2) {
}
} else {
Log.v("SDL", "Multiple ConcurrentModificationException caught while registering sensor listener, canceling operation");
complete = true;
}
}
}
}
private synchronized void UnregisterListener(SensorManager manager, SensorEventListener listener, Sensor sensor) {
int retries = 0;
boolean complete = false;
while (!complete) {
try {
manager.unregisterListener(listener, sensor);
complete = true;
} catch (java.util.ConcurrentModificationException e) {
++retries;
if (retries <= RETRY_COUNT) {
// Sleep a bit and try again
try {
Thread.sleep(1);
} catch (Exception e2) {
}
} else {
Log.v("SDL", "Multiple ConcurrentModificationException caught while unregistering sensor listener, canceling operation");
complete = true;
}
}
}
}
}

View File

@@ -45,6 +45,9 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// Is SurfaceView ready for rendering
protected boolean mIsSurfaceReady;
// Is on-screen keyboard visible
protected boolean mKeyboardVisible;
// Pinch events
private final ScaleGestureDetector scaleGestureDetector;
@@ -208,6 +211,18 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
WindowInsets.Type.displayCutout());
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
if (insets.isVisible(WindowInsets.Type.ime())) {
if (!mKeyboardVisible) {
mKeyboardVisible = true;
SDLActivity.onNativeScreenKeyboardShown();
}
} else {
if (mKeyboardVisible) {
mKeyboardVisible = false;
SDLActivity.onNativeScreenKeyboardHidden();
}
}
}
// Pass these to any child views in case they need them
@@ -280,6 +295,9 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// BUTTON_STYLUS_PRIMARY is 2^5, so shift by 4, and apply SDL_PEN_INPUT_DOWN/SDL_PEN_INPUT_ERASER_TIP
int buttonState = (event.getButtonState() >> 4) | (1 << (toolType == MotionEvent.TOOL_TYPE_STYLUS ? 0 : 30));
if ((event.getButtonState() & MotionEvent.BUTTON_TERTIARY) != 0) {
buttonState |= 0x08;
}
SDLActivity.onNativePen(pointerId, SDLActivity.getMotionListener().getPenDeviceType(event.getDevice()), buttonState, action, x, y, p);
} else { // MotionEvent.TOOL_TYPE_FINGER or MotionEvent.TOOL_TYPE_UNKNOWN
@@ -310,11 +328,11 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
protected void enableSensor(int sensortype, boolean enabled) {
// TODO: This uses getDefaultSensor - what if we have >1 accels?
if (enabled) {
mSensorManager.registerListener(this,
SDLSensorManager.registerListener(mSensorManager, this,
mSensorManager.getDefaultSensor(sensortype),
SensorManager.SENSOR_DELAY_GAME, null);
SensorManager.SENSOR_DELAY_GAME);
} else {
mSensorManager.unregisterListener(this,
SDLSensorManager.unregisterListener(mSensorManager, this,
mSensorManager.getDefaultSensor(sensortype));
}
}

View File

@@ -111,6 +111,42 @@ expression e1;
- SDL_GetEventState(e1)
+ SDL_EventEnabled(e1)
// SDL_JoystickEventState() - replaced with SDL_SetJoystickEventsEnabled()
@@
@@
(
- SDL_JoystickEventState(SDL_IGNORE)
+ SDL_SetJoystickEventsEnabled(false)
|
- SDL_JoystickEventState(SDL_DISABLE)
+ SDL_SetJoystickEventsEnabled(false)
|
- SDL_JoystickEventState(SDL_ENABLE)
+ SDL_SetJoystickEventsEnabled(true)
|
- SDL_JoystickEventState(SDL_QUERY)
+ SDL_JoystickEventsEnabled()
)
// SDL_GameControllerEventState() - replaced with SDL_SetGamepadEventsEnabled()
@@
@@
(
- SDL_GameControllerEventState(SDL_IGNORE)
+ SDL_SetGamepadEventsEnabled(false)
|
- SDL_GameControllerEventState(SDL_DISABLE)
+ SDL_SetGamepadEventsEnabled(false)
|
- SDL_GameControllerEventState(SDL_ENABLE)
+ SDL_SetGamepadEventsEnabled(true)
|
- SDL_GameControllerEventState(SDL_QUERY)
+ SDL_GamepadEventsEnabled()
)
@@
expression e;
@@
@@ -3688,6 +3724,11 @@ typedef SDL_JoystickGUID, SDL_GUID;
+ SDL_GUID
@@
@@
- SDL_JoystickGetGUIDString
+ SDL_GUIDToString
(...)
@@
@@
- SDL_GUIDFromString
+ SDL_StringToGUID
(...)

View File

@@ -267,8 +267,12 @@ class Archiver:
def close(self):
# Archiver is intentionally made invalid after this function
for zf in self._zip_files:
zf.close()
del self._zip_files
self._zip_files = None
for tf in self._tar_files:
tf.close()
del self._tar_files
self._tar_files = None

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# Simple DirectMedia Layer
# Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
# Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#
# Simple DirectMedia Layer
# Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
# Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -406,7 +406,7 @@ int main(void)
printf(
"/*\n"
" Simple DirectMedia Layer\n"
" Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>\n"
" Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>\n"
"\n"
" This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# Simple DirectMedia Layer
# Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
# Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
@@ -36,7 +36,7 @@ my $mem_used = 0;
print <<__EOF__;
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken\@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken\@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,162 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2020-07-26.22; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because '.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "umask 22"
umask 22
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
echo "umask 22"
umask 22
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp=$pathcomp/
done
if test ! -z "$dirmode"; then
echo "chmod $dirmode $file"
chmod "$dirmode" "$file" || errstatus=$?
fi
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# Simple DirectMedia Layer
# Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
# Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
@@ -396,6 +396,19 @@ sub wikify {
return $retval;
}
sub gen_manpage_url {
my $url = shift;
my $desc = shift;
# We have to unmangle some mangling we just did. :/
$url =~ s/\\\[char46\]/./g;
# can't have newlines in this.
$desc =~ s/\n/ /g;
return "\n.URL \"$url\" \"$desc\"\n";
}
my $dewikify_mode = 'md';
my $dewikify_manpage_code_indent = 1;
@@ -459,7 +472,7 @@ sub dewikify_chunk {
}
# links
$str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\n.URL "$1" "$2"\n/g;
$str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]\s*/gen_manpage_url($1, $2)/ge;
# <code></code> is also popular. :/
$str =~ s/\s*\<code>(.*?)<\/code>\s*/\n.BR $1\n/gms;
@@ -496,7 +509,7 @@ sub dewikify_chunk {
}
# links
$str =~ s/\[(.*?)]\((https?\:\/\/.*?)\)/\n.URL "$2" "$1"\n/g;
$str =~ s/\[([^\]]*?)]\((https?\:\/\/.*?)\)\s*/gen_manpage_url($2, $1)/ge;
# <code></code> is also popular. :/
$str =~ s/\s*(\S*?)\`([^\n]*?)\`(\S*)\s*/\n.BR "" "$1" "$2" "$3"\n/gms;
@@ -2912,6 +2925,11 @@ __EOF__
$brief = shift @briefsplit;
$brief = dewikify($wikitype, $brief);
# Hack: `apropros` doesn't like escaped character things like `\[char46]` for `.`...since almost every
# manpage will end their Brief section with a period and it won't wordwrap to risk being a groff control
# character, just replace it.
$brief =~ s/\\\[char46\]/./g;
if (defined $remarks) {
$remarks = dewikify($wikitype, join("\n", @briefsplit) . $remarks);
}

View File

@@ -164,6 +164,22 @@ function(get_git_head_revision _refspecvar _hashvar)
"${GIT_DATA}/grabRef.cmake" @ONLY)
include("${GIT_DATA}/grabRef.cmake")
# Fallback for reftable or other storage formats
if(NOT HEAD_HASH OR HEAD_HASH STREQUAL "")
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE HEAD_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(HEAD_HASH "")
endif()
endif()
endif()
set(${_refspecvar}
"${HEAD_REF}"
PARENT_SCOPE)

View File

@@ -25,19 +25,21 @@ if(HEAD_CONTENTS MATCHES "ref")
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
elseif(EXISTS "@GIT_DIR@/packed-refs")
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
elseif(EXISTS "@GIT_DIR@/reftable/tables.list")
configure_file("@GIT_DIR@/reftable/tables.list" "@GIT_DATA@/reftable-tables.list" COPYONLY)
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
if(NOT HEAD_HASH AND EXISTS "@GIT_DATA@/head-ref")
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@@ -132,7 +132,6 @@ if(EMSCRIPTEN)
set(LIBC_HAS__LTOA "" CACHE INTERNAL "Have symbol _ltoa")
set(LIBC_HAS__STRREV "" CACHE INTERNAL "Have symbol _strrev")
set(LIBC_HAS__UI64TOA "" CACHE INTERNAL "Have symbol _ui64toa")
set(LIBC_HAS__UITOA "" CACHE INTERNAL "Have symbol _uitoa")
set(LIBC_HAS__ULTOA "" CACHE INTERNAL "Have symbol _ultoa")
set(LIBC_HAS__WCSDUP "" CACHE INTERNAL "Have symbol _wcsdup")
set(LIBC_IS_GLIBC "" CACHE INTERNAL "Have symbol __GLIBC__")

View File

@@ -154,7 +154,6 @@ if(MSVC)
set(LIBC_HAS__LTOA "1" CACHE INTERNAL "Have symbol _ltoa")
set(LIBC_HAS__STRREV "1" CACHE INTERNAL "Have symbol _strrev")
set(LIBC_HAS__UI64TOA "1" CACHE INTERNAL "Have symbol _ui64toa")
set(LIBC_HAS__UITOA "" CACHE INTERNAL "Have symbol _uitoa")
set(LIBC_HAS__ULTOA "1" CACHE INTERNAL "Have symbol _ultoa")
set(LIBC_HAS__WCSDUP "1" CACHE INTERNAL "Have symbol _wcsdup")
set(LIBC_IS_GLIBC "" CACHE INTERNAL "Have symbol __GLIBC__")

View File

@@ -135,7 +135,6 @@ if(NGAGESDK)
set(LIBC_HAS__LTOA "" CACHE INTERNAL "Have symbol _ltoa")
set(LIBC_HAS__STRREV "" CACHE INTERNAL "Have symbol _strrev")
set(LIBC_HAS__UI64TOA "" CACHE INTERNAL "Have symbol _ui64toa")
set(LIBC_HAS__UITOA "" CACHE INTERNAL "Have symbol _uitoa")
set(LIBC_HAS__ULTOA "" CACHE INTERNAL "Have symbol _ultoa")
set(LIBC_HAS__WCSDUP "" CACHE INTERNAL "Have symbol _wcsdup")
set(LIBC_IS_GLIBC "" CACHE INTERNAL "Have symbol __GLIBC__")

View File

@@ -21,7 +21,7 @@ macro(option_string _NAME _DESC _VALUE)
add_to_alloptions(${_NAME})
set(${_NAME} ${_VALUE} CACHE STRING "${_DESC}")
set(HAVE_${_NAME} ${_VALUE})
ENDMACRO()
endmacro()
macro(message_bool_option _NAME _VALUE)
set(_PAD "\t")

View File

@@ -402,7 +402,7 @@ macro(CheckX11)
endif()
set(SDL_VIDEO_DRIVER_X11_XCURSOR 1)
else()
SDL_missing_dependency(XCURSOR, SDL_X11_XCURSOR)
SDL_missing_dependency(XCURSOR SDL_X11_XCURSOR)
endif()
endif()
@@ -411,7 +411,7 @@ macro(CheckX11)
set(HAVE_X11_XDBE TRUE)
set(SDL_VIDEO_DRIVER_X11_XDBE 1)
else()
SDL_missing_dependency(XDBE, SDL_X11_XDBE)
SDL_missing_dependency(XDBE SDL_X11_XDBE)
endif()
endif()
@@ -457,7 +457,7 @@ macro(CheckX11)
#include <X11/Xproto.h>
#include <X11/extensions/XInput2.h>
int event_type = XI_GesturePinchBegin;
XITouchClassInfo *t;
XIGesturePinchEvent *t;
Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) {
return (Status)0;
}
@@ -467,7 +467,7 @@ macro(CheckX11)
endif()
else()
SDL_missing_dependency(XINPUT, SDL_X11_XINPUT)
SDL_missing_dependency(XINPUT SDL_X11_XINPUT)
endif()
endif()
@@ -491,7 +491,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XFIXES 1)
set(HAVE_X11_XFIXES TRUE)
else()
SDL_missing_dependency(XFIXES, SDL_X11_XFIXES)
SDL_missing_dependency(XFIXES SDL_X11_XFIXES)
endif()
endif()
@@ -500,7 +500,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XSYNC 1)
set(HAVE_X11_XSYNC TRUE)
else()
SDL_missing_dependency(XSYNC, SDL_X11_XSYNC)
SDL_missing_dependency(XSYNC SDL_X11_XSYNC)
endif()
endif()
@@ -514,7 +514,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XRANDR 1)
set(HAVE_X11_XRANDR TRUE)
else()
SDL_missing_dependency(XRANDR, SDL_X11_XRANDR)
SDL_missing_dependency(XRANDR SDL_X11_XRANDR)
endif()
endif()
@@ -528,7 +528,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1)
set(HAVE_X11_XSCRNSAVER TRUE)
else()
SDL_missing_dependency(XSCRNSAVER, SDL_X11_XSCRNSAVER)
SDL_missing_dependency(XSCRNSAVER SDL_X11_XSCRNSAVER)
endif()
endif()
@@ -537,7 +537,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XSHAPE 1)
set(HAVE_X11_XSHAPE TRUE)
else()
SDL_missing_dependency(XSHAPE, SDL_X11_XSHAPE)
SDL_missing_dependency(XSHAPE SDL_X11_XSHAPE)
endif()
endif()
@@ -751,7 +751,9 @@ macro(CheckWayland)
sdl_link_dependency(libdecor INCLUDES $<TARGET_PROPERTY:PkgConfig::PC_LIBDECOR,INTERFACE_INCLUDE_DIRECTORIES>)
else()
sdl_link_dependency(libdecor LIBS PkgConfig::PC_LIBDECOR PKG_CONFIG_PREFIX PC_LIBDECOR PKG_CONFIG_SPECS ${LibDecor_PKG_CONFIG_SPEC})
endif()
endif()
else()
message(WARNING "Unable to find the libdecor development library (required for window decorations on GNOME and Weston)")
endif()
endif()
@@ -1113,22 +1115,22 @@ macro(CheckUSBHID)
cmake_push_check_state()
check_library_exists(usbhid hid_init "" LIBUSBHID)
if(LIBUSBHID)
check_include_file(usbhid.h HAVE_USBHID_H)
check_include_files("stdint.h;usbhid.h" HAVE_USBHID_H)
if(HAVE_USBHID_H)
set(USB_CFLAGS "-DHAVE_USBHID_H")
endif()
check_include_file(libusbhid.h HAVE_LIBUSBHID_H)
check_include_files("stdint.h;libusbhid.h" HAVE_LIBUSBHID_H)
if(HAVE_LIBUSBHID_H)
string(APPEND USB_CFLAGS " -DHAVE_LIBUSBHID_H")
endif()
set(USB_LIBS ${USB_LIBS} usbhid)
else()
check_include_file(usb.h HAVE_USB_H)
check_include_files("stdint.h;usb.h" HAVE_USB_H)
if(HAVE_USB_H)
set(USB_CFLAGS "-DHAVE_USB_H")
endif()
check_include_file(libusb.h HAVE_LIBUSB_H)
check_include_files("stdint.h;libusb.h" HAVE_LIBUSB_H)
if(HAVE_LIBUSB_H)
string(APPEND USB_CFLAGS " -DHAVE_LIBUSB_H")
endif()
@@ -1141,7 +1143,7 @@ macro(CheckUSBHID)
string(APPEND CMAKE_REQUIRED_FLAGS " ${USB_CFLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES ${USB_LIBS})
check_c_source_compiles("
#include <sys/types.h>
#include <stdint.h>
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
@@ -1167,7 +1169,7 @@ macro(CheckUSBHID)
}" HAVE_USBHID)
if(HAVE_USBHID)
check_c_source_compiles("
#include <sys/types.h>
#include <stdint.h>
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
@@ -1195,7 +1197,7 @@ macro(CheckUSBHID)
endif()
check_c_source_compiles("
#include <sys/types.h>
#include <stdint.h>
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
@@ -1264,18 +1266,21 @@ macro(CheckHIDAPI)
#include <stddef.h>
#include <libusb.h>
int main(int argc, char **argv) {
libusb_close(NULL);
libusb_interrupt_event_handler(NULL);
return 0;
}" HAVE_LIBUSB_H)
cmake_pop_check_state()
if(HAVE_LIBUSB_H)
set(HAVE_LIBUSB TRUE)
target_get_dynamic_library(dynamic_libusb LibUSB::LibUSB)
if(SDL_HIDAPI_LIBUSB_SHARED AND dynamic_libusb)
set(HAVE_HIDAPI_LIBUSB_SHARED ON)
set(SDL_LIBUSB_DYNAMIC "\"${dynamic_libusb}\"")
sdl_link_dependency(hidapi INCLUDES $<TARGET_PROPERTY:LibUSB::LibUSB,INTERFACE_INCLUDE_DIRECTORIES>)
else()
if(SDL_HIDAPI_LIBUSB_SHARED)
target_get_dynamic_library(dynamic_libusb LibUSB::LibUSB)
if(dynamic_libusb)
set(HAVE_HIDAPI_LIBUSB_SHARED ON)
set(SDL_LIBUSB_DYNAMIC "\"${dynamic_libusb}\"")
sdl_link_dependency(hidapi INCLUDES $<TARGET_PROPERTY:LibUSB::LibUSB,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
endif()
if(NOT HAVE_HIDAPI_LIBUSB_SHARED)
sdl_link_dependency(hidapi LIBS LibUSB::LibUSB PKG_CONFIG_SPECS "${LibUSB_PKG_CONFIG_SPEC}" CMAKE_MODULE LibUSB)
endif()
endif()

View File

@@ -11,7 +11,7 @@ macro(SDL_DetectCompiler)
if(MSVC)
set(MSVC_CLANG TRUE)
endif()
elseif(CMAKE_COMPILER_IS_GNUCC)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(USE_GCC TRUE)
elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
set(USE_INTELCC TRUE)

View File

@@ -1,6 +1,6 @@
function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
set(known_archs EMSCRIPTEN ARM32 ARM64 ARM64EC LOONGARCH64 POWERPC32 POWERPC64 RISCV32 RISCV64 X86 X64)
set(known_archs EMSCRIPTEN ARM32 ARM64 ARM64EC LOONGARCH64 MIPS32 MIPS64 POWERPC32 POWERPC64 RISCV32 RISCV64 X86 X64)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(known_arch IN LISTS known_archs)
@@ -37,6 +37,8 @@ function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
set(arch_check_ARM64EC "defined(_M_ARM64EC)")
set(arch_check_EMSCRIPTEN "defined(__EMSCRIPTEN__)")
set(arch_check_LOONGARCH64 "defined(__loongarch64)")
set(arch_check_MIPS32 "(defined(__mips__) && !defined(__mips64))")
set(arch_check_MIPS64 "(defined(__mips__) && defined(__mips64))")
set(arch_check_POWERPC32 "(defined(__PPC__) || defined(__powerpc__)) && !defined(__powerpc64__)")
set(arch_check_POWERPC64 "defined(__PPC64__) || defined(__powerpc64__)")
set(arch_check_RISCV32 "defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32")

View File

@@ -30,12 +30,12 @@ SDL_LDFLAGS="$( pkg-config sdl3 --libs )"
SDL_STATIC_LDFLAGS="$( pkg-config sdl3 --libs --static )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_CFLAGS $CFLAGS $SDL_LDFLAGS $LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_CFLAGS $CFLAGS $SDL_STATIC_LDFLAGS $LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLASG: $LDFLAGS"
echo "-- LDFLAGS: $LDFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"

View File

@@ -49,10 +49,10 @@ There's two ways of using it:
sources.list should be a text file with a source file name in each line
Filenames should be specified relative to the current directory, for example if
you are in the build-scripts directory and want to create the testgles.c test, you'll
you are in the build-scripts directory and want to create the testspriteminimal.c test, you'll
run:
./create-android-project.py org.libsdl.testgles ../test/testgles.c
./create-android-project.py org.libsdl.testspriteminimal ../test/testspriteminimal.c ../test/icon.h
One limitation of this script is that all sources provided will be aggregated into
a single directory, thus all your source files should have a unique name.
@@ -61,6 +61,9 @@ Once the project is complete the script will tell you how to build the project.
If you want to create a signed release APK, you can use the project created by this
utility to generate it.
If you see link errors about missing `SDLTest_*` symbols,
you need to add `../src/test/*.c` as an extra argument to `create-android-project.py`.
Running the script with `--help` will list all available options, and their purposes.
Finally, a word of caution: re running create-android-project.py wipes any changes you may have
@@ -168,7 +171,7 @@ build-scripts/create-android-project.py --variant aar com.yourcompany.yourapp <
Customizing your application name
================================================================================
To customize your application name, edit AndroidManifest.xml and build.gradle to replace
To customize your application name, edit build.gradle to replace
"org.libsdl.app" with an identifier for your product package.
Then create a Java class extending SDLActivity and place it in a directory
@@ -194,6 +197,8 @@ Here's an example of a minimal class file:
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
class, .e.g. "MyGame"
Then edit app/src/main/res/values/strings.xml and change the name there.
Customizing your application icon
================================================================================
@@ -279,7 +284,7 @@ e.g.
You have access to the OpenGL context or rendering API at this point.
However, there's a chance (on older hardware, or on systems under heavy load),
where the graphics context can not be restored. You should listen for the
where the graphics context cannot be restored. You should listen for the
event SDL_EVENT_RENDER_DEVICE_RESET and recreate your OpenGL context and
restore your textures when you get it, or quit the app.
*/
@@ -338,7 +343,7 @@ To enable/disable this behavior, see SDL_hints.h:
Misc
================================================================================
For some device, it appears to works better setting explicitly GL attributes
For some devices, it appears to work better setting explicitly GL attributes
before creating a window:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);

View File

@@ -4,3 +4,4 @@ SDL is fully supported on BSD platforms, and is built using [CMake](README-cmake
If you want to run on the console, you can take a look at [KMSDRM support on BSD](README-kmsbsd.md)
SDL is [not designed to be used in setuid or setgid executables](README-platforms.md#setuid).

View File

@@ -210,12 +210,15 @@ Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
present anything on the screen until your return from your mainloop
function.
Note that on other platforms, SDL will default to vsync _off_ in the 2D render
API. Since changing this will affect how the mainloop runs, the 2D render API
will only change vsync settings if explicitly requested by the app, either
with SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, or calling
SDL_SetRenderVSync(). Otherwise it will default to whatever the Emscripten
mainloop is set to use via emscripten_set_main_loop().
Note that SDL attempts to default to vsync _off_ on all platforms. You almost
certainly do _not_ want this in Emscripten, however, as it will affect the
efficiency of the mainloop. If using OpenGL directly, you should call
SDL_GL_SetSwapInterval(1) sometime near startup; if using the 2D render API,
either create the renderer with with the property
SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER set to 1, or call
SDL_SetRenderVSync(renderer, 1). If you don't explicitly set vsync, you'll get
a higher (but perhaps unstable) framerate, and use more power, but it will
still work. Choosing a vsync of 1 will use requestAnimationFrame if possible.
If you're using the SDL main callbacks, the mainloop defaults to using
requestAnimationFrame (effectively vsync), because it calls
@@ -343,6 +346,64 @@ all has to live in memory at runtime.
[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
gives other options and details, and is worth a read.
Please also read the next section on persistent storage, for a little help
from SDL.
## Automount persistent storage
The file tree in Emscripten is provided by MEMFS by default, which stores all
files in RAM. This is often what you want, because it's fast and can be
accessed with the usual synchronous i/o functions like fopen or SDL_IOFromFile.
You can also write files to MEMFS, but when the browser tab goes away, so do
the files. But we want things like high scores, save games, etc, to still
exist if we reload the game later.
For this, Emscripten offers IDBFS, which backs files with the browser's
[IndexedDB](https://en.wikipedia.org/wiki/IndexedDB) functionality.
To use this, the app has to mount the IDBFS filesystem somewhere in the
virtual file tree, and then wait for it to sync up. This needs to be done in
Javascript code. The sync will not complete until at least one (but possibly
several) iterations of the mainloop have passed, which means you can not
access any saved files during main() or SDL_AppInit() by default.
SDL can solve this problem for you: it can be built to automatically mount the
persistent files from IDBFS to a specific place in the file tree and wait
until the sync has completed before calling main() or SDL_AppInit(), so to
your C code, it looks like the files were always available.
To use this functionality, set the CMake variable
`SDL_EMSCRIPTEN_PERSISTENT_PATH` to a path in the filetree where persistent
storage should be mounted:
```bash
mkdir build
cd build
emcmake cmake -DSDL_EMSCRIPTEN_PERSISTENT_PATH=/storage ..
```
You should also link your app with `-lidbfs.js`. If your project links to SDL
using CMake's find_package(SDL3), or uses `pkg-config sdl3 --libs`, this will
be handled for you when used with an SDL built with
`-DSDL_EMSCRIPTEN_PERSISTENT_PATH`.
Now `/storage` will be prepared when your program runs, and SDL_GetPrefPath()
will return a directory under that path. The storage is mounted with the
`autoPersist: true` option, so when you write to that tree, whether with
SDL APIs or other functions like fopen(), Emscripten will know it needs to
sync that data back to the persistent database, and will do so automatically
within the next few iterations of the mainloop.
It's best to assume the sync will take a few frames to complete, and the
data is not safe until it does.
To summarize how to automate this:
- Build with `emcmake cmake -DSDL_EMSCRIPTEN_PERSISTENT_PATH=/storage`
- Link your app with `-lidbfs.js` if not handled automatically.
- Write under `/storage`, or use SDL_GetPrefPath()
## Customizing index.html
@@ -374,9 +435,9 @@ If you try debugging in Firefox and it doesn't work well for no apparent
reason, try Chrome, and vice-versa. These tools are still relatively new,
and improving all the time.
SDL_Log() (or even plain old printf) will write to the Javascript console,
and honestly I find printf-style debugging to be easier than setting up a build
for proper debugging, so use whatever tools work best for you.
SDL_Log() (or printf) will write to the Javascript console,
so printf-style debugging can be easier than setting up a build
for proper debugging. Use whatever tools work best for you.
## Questions?

View File

@@ -32,7 +32,8 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers
* Single-player games have some additional features available:
* Call `SDL_GetGDKDefaultUser` to get the default XUserHandle pointer.
* `SDL_GetPrefPath` still works, but only for single-player titles.
* `SDL_GetPrefPath` and `SDL_Storage` still work, but only for single-player titles.
* To enable support for these APIs, use `SDL_SetHint` to set `SDL_GDK_SERVICE_CONFIGURATION_ID` to your SCID string at startup (it should be formatted like `"00000000-0000-0000-0000-000000000000"`)
These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!

View File

@@ -73,6 +73,7 @@ Embedding the SDL3 Xcode project makes SDL3.framework a target of your app, so i
fi
```
3. Below the script entry uncheck the "Run Script:" options "For install builds only" and "Based on dependency analysis"
4. Edit the Build Settings and set "User Script Sandboxing" to "No".
TODO: Add information regarding App Store requirements such as icons, etc.
@@ -102,6 +103,19 @@ matrix using the size in points (SDL_GetWindowSize()) can be used in order to
display content at the same scale no matter whether a Retina device is used or not.
Notes -- Getting full screen resolution
==============================================================================
Make sure that you have a Launch Screen key in your Info.plist, e.g.
```
<key>UILaunchScreen</key>
<dict/>
```
If you don't specify a launch screen, then the OS will assume that your
application needs an older compatibility mode and will get a limited
resolution screen.
Notes -- Application events
==============================================================================

View File

@@ -8,6 +8,7 @@ system does not have the XRandR libraries installed, it will be disabled
at runtime, and you won't get a missing library error, at least with the
default configuration parameters.
SDL is [not designed to be used in setuid or setgid executables](README-platforms.md#setuid).
Build Dependencies
--------------------------------------------------------------------------------
@@ -19,7 +20,7 @@ Ubuntu 18.04, all available features enabled:
libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libthai-dev
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libthai-dev libusb-1.0-0-dev
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev` to that command line.
@@ -36,6 +37,8 @@ Fedora 35, all available features enabled:
Fedora 39+ can also add `liburing-devel` to that command line.
Fedora 40+ needs `zlib-ng-compat-static` to be added to that command line.
NOTES:
- The sndio audio target is unavailable on Fedora (but probably not what you
should want to use anyhow).

View File

@@ -32,6 +32,10 @@ sudo cmake --install .
Please note that building SDL requires at least Xcode 12.2 and the macOS 11.0 SDK.
If you are getting errors building SDL_mfijoystick.m with Xcode 12.2, find your SDKs
directory and move MacOSX10.15.sdk out of the way so it isn't accidentally being used
by the build environment.
To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode.
@@ -73,6 +77,8 @@ NSApplicationDelegate implementation:
}
```
SDL is [not designed to be used in setuid or setgid executables](README-platforms.md#setuid).
# Using the Simple DirectMedia Layer with a traditional Makefile
An existing build system for your SDL app has good chances to work almost

View File

@@ -1447,7 +1447,7 @@ The following functions have been removed:
* SDL_GetTextureUserData() - use SDL_GetTextureProperties() instead
* SDL_RenderGetIntegerScale()
* SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
* SDL_RenderTargetSupported() - render targets are always supported
* SDL_RenderTargetSupported() - render targets are usually supported; just create a texture with SDL_TEXTUREACCESS_TARGET and see if it fails.
* SDL_SetTextureUserData() - use SDL_GetTextureProperties() instead
The following enums have been renamed:
@@ -1461,7 +1461,7 @@ The following symbols have been removed:
* SDL_RENDERER_ACCELERATED - all renderers except `SDL_SOFTWARE_RENDERER` are accelerated
* SDL_RENDERER_PRESENTVSYNC - replaced with SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER during renderer creation and SDL_PROP_RENDERER_VSYNC_NUMBER after renderer creation
* SDL_RENDERER_SOFTWARE - you can check whether the name of the renderer is `SDL_SOFTWARE_RENDERER`
* SDL_RENDERER_TARGETTEXTURE - all renderers support target texture functionality
* SDL_RENDERER_TARGETTEXTURE - most renderers support target texture functionality; just create a texture with SDL_TEXTUREACCESS_TARGET and see if it fails.
* SDL_ScaleModeBest - use SDL_SCALEMODE_LINEAR instead
## SDL_rwops.h

View File

@@ -45,3 +45,18 @@ All of these still work with [SDL2](/SDL2), which is an incompatible API, but an
- OS/2
- WinPhone
- WinRT/UWP
## General notes for Unix platforms
Some aspects of SDL functionality are common to all Unix-based platforms.
### <a name=setuid></a>Privileged processes (setuid, setgid, setcap)
SDL is not designed to be used in programs with elevated privileges,
such as setuid (`chmod u+s`) or setgid (`chmod g+s`) executables,
or executables with file-based capabilities
(`setcap cap_sys_nice+ep` or similar).
It does not make any attempt to avoid trusting environment variables
or other aspects of the inherited execution environment.
Programs running with elevated privileges in an attacker-controlled
execution environment should not call SDL functions.

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -44,6 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
} else if (devcount == 0) {
SDL_Log("Couldn't find any camera devices! Please connect a camera and try again.");
SDL_free(devices);
return SDL_APP_FAILURE;
}

View File

@@ -206,7 +206,7 @@ static void draw(SDL_Renderer *renderer, const float (*edges)[6], const Player p
for (i = 0; i < players_len; i++) {
const Player *player = &players[i];
float mod_x = (float)(i % part_hor);
float mod_y = (float)(i / part_hor);
float mod_y = (float)i / part_hor;
float hor_origin = (mod_x + 0.5f) * size_hor;
float ver_origin = (mod_y + 0.5f) * size_ver;
float cam_origin = (float)(0.5 * SDL_sqrt(size_hor * size_hor + size_ver * size_ver));
@@ -477,4 +477,4 @@ SDL_AppResult SDL_AppIterate(void *appstate)
void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
SDL_free(appstate); // just free the memory, SDL will clean up the window/renderer for us.
}
}

View File

@@ -33,7 +33,6 @@ typedef struct {
SDL_Renderer* renderer;
SDL_Palette* palette;
SDL_Texture* texture;
SDL_Texture* rendertarget; /* we need this render target for text to look good */
SDL_AudioStream* audiostream;
char status[SCREEN_W / 8];
int status_ticks;
@@ -75,6 +74,8 @@ static bool load(BytePusher* vm, SDL_IOStream* stream, bool closeio) {
size_t bytes_read = 0;
bool ok = true;
vm->display_help = true; // will set to false if load succeeds.
SDL_memset(vm->ram, 0, RAM_SIZE);
if (!stream) {
@@ -199,13 +200,11 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
}
vm->texture = SDL_CreateTexture(vm->renderer, SDL_PIXELFORMAT_INDEX8, SDL_TEXTUREACCESS_STREAMING, SCREEN_W, SCREEN_H);
vm->rendertarget = SDL_CreateTexture(vm->renderer, SDL_PIXELFORMAT_UNKNOWN, SDL_TEXTUREACCESS_TARGET, SCREEN_W, SCREEN_H);
if (!vm->texture || !vm->rendertarget) {
if (!vm->texture) {
return SDL_APP_FAILURE;
}
SDL_SetTexturePalette(vm->texture, vm->palette);
SDL_SetTextureScaleMode(vm->texture, SDL_SCALEMODE_NEAREST);
SDL_SetTextureScaleMode(vm->rendertarget, SDL_SCALEMODE_NEAREST);
if (!(vm->audiostream = SDL_OpenAudioDeviceStream(
SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &audiospec, NULL, NULL
@@ -274,26 +273,26 @@ SDL_AppResult SDL_AppIterate(void* appstate) {
if (updated) {
const void *pixels = &vm->ram[(Uint32)vm->ram[IO_SCREEN_PAGE] << 16];
SDL_UpdateTexture(vm->texture, NULL, pixels, SCREEN_W);
SDL_SetRenderTarget(vm->renderer, vm->rendertarget);
SDL_RenderTexture(vm->renderer, vm->texture, NULL, NULL);
if (vm->display_help) {
print(vm, 4, 4, "Drop a BytePusher file in this");
print(vm, 8, 12, "window to load and run it!");
print(vm, 4, 28, "Press ENTER to switch between");
print(vm, 8, 36, "positional and symbolic input.");
}
if (vm->status_ticks > 0) {
vm->status_ticks -= 1;
print(vm, 4, SCREEN_H - 12, vm->status);
}
}
SDL_SetRenderTarget(vm->renderer, NULL);
SDL_RenderClear(vm->renderer);
SDL_RenderTexture(vm->renderer, vm->rendertarget, NULL, NULL);
if (vm->display_help) {
print(vm, 4, 4, "Drop a BytePusher file in this");
print(vm, 8, 12, "window to load and run it!");
print(vm, 4, 28, "Press ENTER to switch between");
print(vm, 8, 36, "positional and symbolic input.");
} else {
SDL_RenderTexture(vm->renderer, vm->texture, NULL, NULL);
}
if (vm->status_ticks > 0) {
if (updated) {
vm->status_ticks--;
}
print(vm, 4, SCREEN_H - 12, vm->status);
}
SDL_RenderPresent(vm->renderer);
return SDL_APP_CONTINUE;
@@ -387,7 +386,6 @@ void SDL_AppQuit(void* appstate, SDL_AppResult result) {
if (appstate) {
BytePusher* vm = (BytePusher*)appstate;
SDL_DestroyAudioStream(vm->audiostream);
SDL_DestroyTexture(vm->rendertarget);
SDL_DestroyTexture(vm->texture);
SDL_DestroyPalette(vm->palette);
SDL_DestroyRenderer(vm->renderer);

View File

@@ -158,7 +158,8 @@ SDL_AppResult SDL_AppIterate(void *appstate)
}
}
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF); /* yellow */
/* draw axes in blue. */
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xFF, 0xFF); /* blue */
/* left thumb axis. */
axis_x = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTX);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -90,7 +90,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* ...and also fill a bunch of rectangles at once... */
for (i = 0; i < SDL_arraysize(rects); i++) {
const float w = (float) (WINDOW_WIDTH / SDL_arraysize(rects));
const float w = ((float) WINDOW_WIDTH / SDL_arraysize(rects));
const float h = i * 8.0f;
rects[i].x = i * w;
rects[i].y = WINDOW_HEIGHT - h;

View File

@@ -40,14 +40,14 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
/* Textures are pixel data that we upload to the video hardware for fast drawing. Lots of 2D
engines refer to these as "sprites." We'll do a static texture (upload once, draw many
times) with data from a bitmap file. */
times) with data from a png file. */
/* SDL_Surface is pixel data the CPU can access. SDL_Texture is pixel data the GPU can access.
Load a .png into a surface, move it to a texture from there. */
SDL_asprintf(&png_path, "%ssample.png", SDL_GetBasePath()); /* allocate a string of the full file path */
surface = SDL_LoadPNG(png_path);
if (!surface) {
SDL_Log("Couldn't load bitmap: %s", SDL_GetError());
SDL_Log("Couldn't load png: %s", SDL_GetError());
return SDL_APP_FAILURE;
}

View File

@@ -66,7 +66,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* To update a streaming texture, you need to lock it first. This gets you access to the pixels.
Note that this is considered a _write-only_ operation: the buffer you get from locking
might not acutally have the existing contents of the texture, and you have to write to every
might not actually have the existing contents of the texture, and you have to write to every
locked pixel! */
/* You can use SDL_LockTexture() to get an array of raw pixels, but we're going to use

View File

@@ -66,7 +66,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
SDL_SetRenderScale(renderer, 1.0f, 1.0f);
SDL_RenderDebugText(renderer, 64, 350, "This only does ASCII chars. So this laughing emoji won't draw: 🤣");
SDL_RenderDebugTextFormat(renderer, (float) ((WINDOW_WIDTH - (charsize * 46)) / 2), 400, "(This program has been running for %" SDL_PRIu64 " seconds.)", SDL_GetTicks() / 1000);
SDL_RenderDebugTextFormat(renderer, ((float) (WINDOW_WIDTH - (charsize * 46)) / 2), 400, "(This program has been running for %" SDL_PRIu64 " seconds.)", SDL_GetTicks() / 1000);
SDL_RenderPresent(renderer); /* put it all on the screen! */

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -92,7 +92,7 @@
#output-container:hover,
#output-container:focus-within {
top: 50%;
top: 20%;
}
#output-container:focus-within {
@@ -151,7 +151,7 @@
#source-code:hover,
#source-code:focus-within {
top: 50%;
top: 20%;
}
#source-code:focus-within {
@@ -241,7 +241,7 @@
return function(text) {
var elem = document.getElementById('output-container');
if (elem.style['top'] == '') {
elem.style['top'] = '50%';
elem.style['top'] = '20%';
setTimeout(function() { elem.style['top'] = ''; }, 3000);
}

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.3.4
* Main include header for the SDL library, version 3.4.12
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -126,17 +126,20 @@ extern "C" {
*/
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
#elif defined(_MSC_VER) && _MSC_VER >= 1310
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif defined(__MINGW32__)
#include <intrin.h>
#define SDL_TriggerBreakpoint() __debugbreak()
#elif defined(_MSC_VER) && defined(_M_IX86)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif SDL_HAS_BUILTIN(__builtin_trap)
#define SDL_TriggerBreakpoint() __builtin_trap()
#elif (defined(__GNUC__) || defined(__clang__) || defined(__TINYC__)) && (defined(__i386__) || defined(__x86_64__))
#elif (defined(__GNUC__) || defined(__clang__) || defined(__TINYC__) || defined(__slimcc__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
@@ -160,7 +163,7 @@ extern "C" {
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
* A macro that reports the current function being compiled.
* A constant that contains the current function being compiled.
*
* If SDL can't figure how the compiler reports this, it will use "???".
*
@@ -168,13 +171,15 @@ extern "C" {
*/
#define SDL_FUNCTION __FUNCTION__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
#elif !defined(SDL_FUNCTION)
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
#endif
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
@@ -263,7 +268,7 @@ disable assertions.
*/
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#elif defined(_MSC_VER) /* Avoid /W4 warnings. */
#elif defined(_MSC_VER) && !defined(__clang__) /* Avoid /W4 warnings. */
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -213,6 +213,8 @@ typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue;
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
* failure; call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CloseAsyncIO
@@ -531,6 +533,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue)
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_LoadFile_IO

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -156,6 +156,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock);
*/
#define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier()
#elif SDL_HAS_BUILTIN(__atomic_signal_fence) || (defined(__GNUC__) && (__GNUC__ >= 5))
#define SDL_CompilerBarrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
#elif defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
@@ -167,8 +169,9 @@ void _ReadWriteBarrier(void);
extern __inline void SDL_CompilerBarrier(void);
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else
/* We don't unlock here to avoid possible infinite recursion */
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_LockSpinlock(&_tmp); SDL_UnlockSpinlock(&_tmp); }
{ SDL_SpinLock _tmp = 0; SDL_LockSpinlock(&_tmp); }
#endif
/**
@@ -275,12 +278,19 @@ extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
*/
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#elif SDL_HAS_BUILTIN(__atomic_thread_fence) || (defined(__GNUC__) && (__GNUC__ >= 5))
#define SDL_MemoryBarrierRelease() __atomic_thread_fence(__ATOMIC_RELEASE)
#define SDL_MemoryBarrierAcquire() __atomic_thread_fence(__ATOMIC_ACQUIRE)
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
#elif defined(__GNUC__) && defined(__aarch64__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ishld" : : : "memory")
#elif defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC))
#include <arm64intr.h>
#define SDL_MemoryBarrierRelease() __dmb(_ARM64_BARRIER_ISH)
#define SDL_MemoryBarrierAcquire() __dmb(_ARM64_BARRIER_ISHLD)
#elif defined(__GNUC__) && defined(__arm__)
#if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */
/* Information from:

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -434,7 +434,8 @@ typedef struct SDL_AudioSpec
* - It can handle incoming data in any variable size.
* - It can handle input/output format changes on the fly.
* - It can remap audio channels between inputs and outputs.
* - You push data as you have it, and pull it when you need it
* - You push data as you have it, and pull it when you need it; the
* stream will buffer data as needed.
* - It can also function as a basic audio data queue even if you just have
* sound that needs to pass from one place to another.
* - You can hook callbacks up to them when more data is added or requested,
@@ -577,6 +578,15 @@ extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int
/**
* Get the human-readable name of a specific audio device.
*
* **WARNING**: this function will work with SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK
* and SDL_AUDIO_DEVICE_DEFAULT_RECORDING, returning the current default
* physical devices' names. However, as the default device may change at any
* time, it is likely better to show a generic name to the user, like "System
* default audio device" or perhaps "default [currently %s]". Do not store
* this name to disk to reidentify the device in a later run of the program,
* as the default might change in general, and the string will be the name of
* a specific device and not the abstract system default.
*
* \param devid the instance ID of the device to query.
* \returns the name of the audio device, or NULL on failure; call
* SDL_GetError() for more information.
@@ -1045,8 +1055,15 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamDevice(SDL_Audio
/**
* Create a new audio stream.
*
* \param src_spec the format details of the input audio.
* \param dst_spec the format details of the output audio.
* Note that `src_spec` or `dst_spec` may be NULL, but any attempts to
* put or get data from an audio stream will fail until it has valid
* specs assigned to both ends of the stream. Specs can be assigned later
* through SDL_SetAudioStreamFormat(), or binding the stream to an audio
* device (which will set the format of only the input or output,
* depending on what kind of device the stream was bound to).
*
* \param src_spec the format details of the input audio. May be NULL.
* \param dst_spec the format details of the output audio. May be NULL.
* \returns a new audio stream on success or NULL on failure; call
* SDL_GetError() for more information.
*
@@ -1128,6 +1145,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea
* be ignored, but this will not report an error. The other side's format can
* be changed.
*
* `src_spec` and `dst_spec` may each be NULL; a NULL spec signals not to
* change the current format for that side of the stream.
*
* \param stream the stream the format is being changed.
* \param src_spec the new format of the audio input; if NULL, it is not
* changed.
@@ -1340,7 +1360,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_SetAudioStreamInputChannelMap
* \sa SDL_SetAudioStreamOutputChannelMap
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count);
@@ -1834,6 +1854,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream);
* appropriate, but the system goes on with the data currently available to it
* if this callback does nothing.
*
* Do not call SDL_DestroyAudioStream() on `stream` during this callback.
*
* \param stream the SDL audio stream associated with this callback.
* \param additional_amount the amount of data, in bytes, that is needed right
* now.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -469,7 +469,7 @@
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! macOS - breaks precompiled headers */
#endif /* __MACH__ */
#ifndef SDL_FALLTHROUGH
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -48,8 +48,7 @@ extern __inline int _SDL_bsr_watcom(Uint32);
/**
* Get the index of the most significant (set) bit in a 32-bit number.
*
* Result is undefined when called with 0. This operation can also be stated
* as "count leading zeroes" and "log base 2".
* This operation can also be stated as "count leading zeroes" and "log base 2".
*
* Note that this is a forced-inline function in a header, and not a public
* API function available in the SDL library (which is to say, the code is

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -252,7 +252,7 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
* \sa SDL_GetClipboardData
* \sa SDL_HasClipboardData
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char *const *mime_types, size_t num_mime_types);
/**
* Clear the clipboard data.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -32,21 +32,23 @@
* this CMake snippet to check for support:
*
* ```cmake
* set(CHECK_ELF_DLNOTES_SRC [==[
* #ifndef __ELF__
* ELF DL notes is only supported on ELF platforms
* #endif
* __attribute__ ((used,aligned(4),section(".note.dlopen"))) static const struct {
* struct { int a; int b; int c; } hdr; char name[4]; __attribute__((aligned(4))) char json[24];
* } dlnote = { { 4, 0x407c0c0aU, 16 }, "FDO", "[\\"a\\":{\\"a\\":\\"1\\",\\"b\\":\\"2\\"}]" };
* int main(int argc, char *argv[]) {
* return argc + dlnote.hdr.a;
* }
* ]==])
* check_c_source_compiles("${CHECK_ELF_DLNOTES_SRC}" COMPILER_SUPPORTS_ELFNOTES)
* if(NOT COMPILER_SUPPORTS_ELFNOTES)
* set(SDL_DISABLE_DLOPEN_NOTES TRUE)
* endif()
* include(CheckCSourceCompiles)
* find_package(SDL3 REQUIRED CONFIG COMPONENTS Headers)
* list(APPEND CMAKE_REQUIRED_LIBRARIES SDL3::Headers)
* check_c_source_compiles([==[
* #include <SDL3/SDL_dlopennote.h>
* SDL_ELF_NOTE_DLOPEN("sdl-video",
* "Support for video through SDL",
* SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
* "libSDL-1.2.so.0", "libSDL-2.0.so.0", "libSDL3.so.0"
* )
* int main(int argc, char *argv[]) {
* return argc + argv[0][1];
* }
* ]==] COMPILER_SUPPORTS_SDL_ELF_NOTE_DLOPEN)
* if(NOT COMPILER_SUPPORTS_SDL_ELF_NOTE_DLOPEN)
* add_compile_definitions(-DSDL_DISABLE_DLOPEN_NOTE)
* endif()
* ```
*/
@@ -141,36 +143,37 @@
#define SDL_ELF_NOTE_INTERNAL(json, variable_name) \
SDL_ELF_NOTE_INTERNAL2(json, variable_name)
#define SDL_SONAME_ARRAY1(N1) "[\"" N1 "\"]"
#define SDL_SONAME_ARRAY2(N1,N2) "[\"" N1 "\",\"" N2 "\"]"
#define SDL_SONAME_ARRAY3(N1,N2,N3) "[\"" N1 "\",\"" N2 "\",\"" N3 "\"]"
#define SDL_SONAME_ARRAY4(N1,N2,N3,N4) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\"]"
#define SDL_SONAME_ARRAY5(N1,N2,N3,N4,N5) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\"]"
#define SDL_SONAME_ARRAY6(N1,N2,N3,N4,N5,N6) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\"]"
#define SDL_SONAME_ARRAY7(N1,N2,N3,N4,N5,N6,N7) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\"]"
#define SDL_SONAME_ARRAY8(N1,N2,N3,N4,N5,N6,N7,N8) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\",\"" N8 "\"]"
#define SDL_SONAME_ARRAY_GET(N1,N2,N3,N4,N5,N6,N7,N8,NAME,...) NAME
#define SDL_SONAME_ARRAY(...) \
SDL_SONAME_ARRAY_GET(__VA_ARGS__, \
SDL_SONAME_ARRAY8, \
SDL_SONAME_ARRAY7, \
SDL_SONAME_ARRAY6, \
SDL_SONAME_ARRAY5, \
SDL_SONAME_ARRAY4, \
SDL_SONAME_ARRAY3, \
SDL_SONAME_ARRAY2, \
SDL_SONAME_ARRAY1 \
#define SDL_DLNOTE_JSON_ARRAY1(N1) "[\"" N1 "\"]"
#define SDL_DLNOTE_JSON_ARRAY2(N1,N2) "[\"" N1 "\",\"" N2 "\"]"
#define SDL_DLNOTE_JSON_ARRAY3(N1,N2,N3) "[\"" N1 "\",\"" N2 "\",\"" N3 "\"]"
#define SDL_DLNOTE_JSON_ARRAY4(N1,N2,N3,N4) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\"]"
#define SDL_DLNOTE_JSON_ARRAY5(N1,N2,N3,N4,N5) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\"]"
#define SDL_DLNOTE_JSON_ARRAY6(N1,N2,N3,N4,N5,N6) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\"]"
#define SDL_DLNOTE_JSON_ARRAY7(N1,N2,N3,N4,N5,N6,N7) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\"]"
#define SDL_DLNOTE_JSON_ARRAY8(N1,N2,N3,N4,N5,N6,N7,N8) "[\"" N1 "\",\"" N2 "\",\"" N3 "\",\"" N4 "\",\"" N5 "\",\"" N6 "\",\"" N7 "\",\"" N8 "\"]"
#define SDL_DLNOTE_JSON_ARRAY_GET(N1,N2,N3,N4,N5,N6,N7,N8,NAME,...) NAME
#define SDL_DLNOTE_JSON_ARRAY(...) \
SDL_DLNOTE_JSON_ARRAY_GET( \
__VA_ARGS__, \
SDL_DLNOTE_JSON_ARRAY8, \
SDL_DLNOTE_JSON_ARRAY7, \
SDL_DLNOTE_JSON_ARRAY6, \
SDL_DLNOTE_JSON_ARRAY5, \
SDL_DLNOTE_JSON_ARRAY4, \
SDL_DLNOTE_JSON_ARRAY3, \
SDL_DLNOTE_JSON_ARRAY2, \
SDL_DLNOTE_JSON_ARRAY1 \
)(__VA_ARGS__)
/* Create "unique" variable name using __LINE__,
* so creating elf notes on the same line is not supported
* so creating multiple elf notes on the same line is not supported
*/
#define SDL_ELF_NOTE_JOIN2(A,B) A##B
#define SDL_ELF_NOTE_JOIN(A,B) SDL_ELF_NOTE_JOIN2(A,B)
#define SDL_ELF_NOTE_UNIQUE_NAME SDL_ELF_NOTE_JOIN(s_SDL_dlopen_note_, __LINE__)
#define SDL_DLNOTE_JOIN2(A,B) A##B
#define SDL_DLNOTE_JOIN(A,B) SDL_DLNOTE_JOIN2(A,B)
#define SDL_DLNOTE_UNIQUE_NAME SDL_DLNOTE_JOIN(s_SDL_dlopen_note_, __LINE__)
/**
* Note that your application has dynamic shared library dependencies.
* Add a note that your application has dynamic shared library dependencies.
*
* You can do this by adding the following to the global scope:
*
@@ -180,9 +183,11 @@
* "Support for loading PNG images using libpng (required for APNG)",
* SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
* "libpng12.so.0"
* );
* )
* ```
*
* A trailing semicolon is not needed.
*
* Or if you support multiple versions of a library, you can list them:
*
* ```c
@@ -192,9 +197,12 @@
* "Create windows through SDL video backend",
* SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED
* "libSDL-1.2.so.0", "libSDL2-2.0.so.0", "libSDL3.so.0"
* );
* )
* ```
*
* This macro is not available for compilers that do not support variadic
* macro's.
*
* \since This macro is available since SDL 3.4.0.
*
* \sa SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED
@@ -206,8 +214,8 @@
"[{\"feature\":\"" feature \
"\",\"description\":\"" description \
"\",\"priority\":\"" priority \
"\",\"soname\":" SDL_SONAME_ARRAY(__VA_ARGS__) "}]", \
SDL_ELF_NOTE_UNIQUE_NAME)
"\",\"soname\":" SDL_DLNOTE_JSON_ARRAY(__VA_ARGS__) "}]", \
SDL_DLNOTE_UNIQUE_NAME);
#elif defined(__GNUC__) && __GNUC__ < 3
@@ -216,7 +224,6 @@
#elif defined(_MSC_VER) && _MSC_VER < 1400
/* Variadic macros are not supported */
#define SDL_ELF_NOTE_DLOPEN
#else

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -46,7 +46,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
@@ -208,7 +208,7 @@ _m_prefetch(void *__P)
#else
/* By default, assume that floats words follow the memory system mode. */
#define SDL_FLOATWORDORDER SDL_BYTEORDER
#endif /* __FLOAT_WORD_ORDER__ */
#endif /* SDL_WIKI_DOCUMENTATION_SECTION */
#endif /* !SDL_FLOATWORDORDER */

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -456,7 +456,7 @@ typedef struct SDL_MouseMotionEvent
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */
SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, SDL_PEN_MOUSEID for pen events, or 0 */
SDL_MouseButtonFlags state; /**< The current button state */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
@@ -1256,15 +1256,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType)
* Poll for currently pending events.
*
* If `event` is not NULL, the next event is removed from the queue and stored
* in the SDL_Event structure pointed to by `event`. The 1 returned refers to
* this event, immediately stored in the SDL Event structure -- not an event
* to follow.
* in the SDL_Event structure pointed to by `event`.
*
* If `event` is NULL, it simply returns 1 if there is an event in the queue,
* but will not remove it from the queue.
* If `event` is NULL, it simply returns true if there is an event in the
* queue, but will not remove it from the queue.
*
* As this function may implicitly call SDL_PumpEvents(), you can only call
* this function in the thread that set the video mode.
* this function in the thread that initialized the video subsystem.
*
* SDL_PollEvent() is the favored way of receiving system events since it can
* be done from the main loop and does not suspend the main loop while waiting

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -241,9 +241,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder);
/**
* Types of filesystem entries.
*
* Note that there may be other sorts of items on a filesystem: devices,
* symlinks, named pipes, etc. They are currently reported as
* SDL_PATHTYPE_OTHER.
* Note that there may be other sorts of items on a filesystem: devices, named
* pipes, etc. They are currently reported as SDL_PATHTYPE_OTHER.
*
* \since This enum is available since SDL 3.2.0.
*
@@ -457,6 +456,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *n
/**
* Get information about a filesystem path.
*
* Symlinks, on filesystems that support them, are always followed, so you
* will always get information on what the symlink eventually points to, and
* not the symlink itself.
*
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -48,6 +48,9 @@
* SDL_INIT_GAMEPAD flag. This causes SDL to scan the system for gamepads, and
* load appropriate drivers.
*
* If you're using SDL gamepad support in a Steam game, you must call
* SteamAPI_InitEx() before calling SDL_Init().
*
* If you would like to receive gamepad updates while the application is in
* the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
@@ -164,11 +167,11 @@ typedef enum SDL_GamepadButton
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
SDL_GAMEPAD_BUTTON_MISC1, /**< Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1, /**< Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button) */
SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, /**< Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2, /**< Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button) */
SDL_GAMEPAD_BUTTON_LEFT_PADDLE2, /**< Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button) */
SDL_GAMEPAD_BUTTON_MISC1, /**< Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Steam Controller QAM button, Amazon Luna microphone button, Google Stadia capture button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1, /**< Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button, Steam Controller R4 button) */
SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, /**< Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button, Steam Controller L4 button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2, /**< Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button, Steam Controller R5 button) */
SDL_GAMEPAD_BUTTON_LEFT_PADDLE2, /**< Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button, Steam Controller L5 button) */
SDL_GAMEPAD_BUTTON_TOUCHPAD, /**< PS4/PS5 touchpad button */
SDL_GAMEPAD_BUTTON_MISC2, /**< Additional button */
SDL_GAMEPAD_BUTTON_MISC3, /**< Additional button (e.g. Nintendo GameCube left trigger click) */
@@ -1278,7 +1281,7 @@ extern SDL_DECLSPEC Sint16 SDLCALL SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_
* You do not normally need to call this function unless you are parsing
* SDL_Gamepad mappings in your own code.
*
* \param str string representing a SDL_Gamepad axis.
* \param str string representing a SDL_Gamepad button.
* \returns the SDL_GamepadButton enum corresponding to the input string, or
* `SDL_GAMEPAD_BUTTON_INVALID` if no match was found.
*
@@ -1492,7 +1495,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game
* Get the current state of a gamepad sensor.
*
* The number of values and interpretation of the data is sensor dependent.
* See SDL_sensor.h for the details for each type of sensor.
* See the remarks in SDL_SensorType for details for each type of sensor.
*
* \param gamepad the gamepad to query.
* \param type the type of sensor to query.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -1398,11 +1398,12 @@ typedef struct SDL_GPUViewport
* SDL_DownloadFromGPUTexture are used as default values respectively and data
* is considered to be tightly packed.
*
* **WARNING**: Direct3D 12 requires texture data row pitch to be 256 byte
* aligned, and offsets to be aligned to 512 bytes. If they are not, SDL will
* make a temporary copy of the data that is properly aligned, but this adds
* overhead to the transfer process. Apps can avoid this by aligning their
* data appropriately, or using a different GPU backend than Direct3D 12.
* **WARNING**: On some older/integrated hardware, Direct3D 12 requires
* texture data row pitch to be 256 byte aligned, and offsets to be aligned to
* 512 bytes. If they are not, SDL will make a temporary copy of the data that
* is properly aligned, but this adds overhead to the transfer process. Apps
* can avoid this by aligning their data appropriately, or using a different
* GPU backend than Direct3D 12.
*
* \since This struct is available since SDL 3.2.0.
*
@@ -2306,6 +2307,21 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
* useful for targeting Intel Haswell and Broadwell GPUs; other hardware
* either supports Tier 2 Resource Binding or does not support D3D12 in any
* capacity. Defaults to false.
* - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER`: Certain
* feature checks are only possible on Windows 11 by default. By setting
* this alongside `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`
* and vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make
* those feature checks possible on older platforms. The version you provide
* must match the one given in the DLL.
* - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING`: Certain
* feature checks are only possible on Windows 11 by default. By setting
* this alongside
* `SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER` and
* vendoring D3D12Core.dll from the D3D12 Agility SDK, you can make those
* feature checks possible on older platforms. The path you provide must be
* relative to the executable path of your app. Be sure not to put the DLL
* in the same directory as the exe; Microsoft strongly advises against
* this!
*
* With the Vulkan backend:
*
@@ -2321,6 +2337,15 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDevice(
* increasing the API version and opting into extensions aside from the
* minimal set SDL requires.
*
* With the Metal backend: -
* `SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN`: By default,
* macOS support requires what Apple calls "MTLGPUFamilyMac2" hardware or
* newer. However, an application can set this property to true to enable
* support for "MTLGPUFamilyMac1" hardware, if (and only if) the application
* does not write to sRGB textures. (For history's sake: MacFamily1 also does
* not support indirect command buffers, MSAA depth resolve, and stencil
* resolve/feedback, but these are not exposed features in SDL_GPU.)
*
* \param props the properties to use.
* \returns a GPU context on success or NULL on failure; call SDL_GetError()
* for more information.
@@ -2351,8 +2376,11 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDeviceWithProperties(
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN "SDL.gpu.device.create.shaders.metallib"
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN "SDL.gpu.device.create.d3d12.allowtier1resourcebinding"
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING "SDL.gpu.device.create.d3d12.semantic"
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN "SDL.gpu.device.create.vulkan.requirehardwareacceleration"
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER "SDL.gpu.device.create.d3d12.agility_sdk_version"
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING "SDL.gpu.device.create.d3d12.agility_sdk_path"
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN "SDL.gpu.device.create.vulkan.requirehardwareacceleration"
#define SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER "SDL.gpu.device.create.vulkan.options"
#define SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN "SDL.gpu.device.create.metal.allowmacfamily1"
/**
@@ -2361,7 +2389,7 @@ extern SDL_DECLSPEC SDL_GPUDevice * SDLCALL SDL_CreateGPUDeviceWithProperties(
* When no such structure is provided, SDL will use Vulkan API version 1.0 and
* a minimal set of features. The requested API version influences how the
* feature_list is processed by SDL. When requesting API version 1.0, the
* feature_list is ignored. Only the vulkan_10_phyisical_device_features and
* feature_list is ignored. Only the vulkan_10_physical_device_features and
* the extension lists are used. When requesting API version 1.1, the
* feature_list is scanned for feature structures introduced in Vulkan 1.1.
* When requesting Vulkan 1.2 or higher, the feature_list is additionally
@@ -3139,7 +3167,7 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer * SDLCALL SDL_AcquireGPUCommandBuffer(
/**
* Pushes data to a vertex uniform slot on the command buffer.
*
* Subsequent draw calls will use this uniform data.
* Subsequent draw calls in this command buffer will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
@@ -3164,7 +3192,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData(
/**
* Pushes data to a fragment uniform slot on the command buffer.
*
* Subsequent draw calls will use this uniform data.
* Subsequent draw calls in this command buffer will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
@@ -3186,7 +3214,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData(
/**
* Pushes data to a uniform slot on the command buffer.
*
* Subsequent draw calls will use this uniform data.
* Subsequent draw calls in this command buffer will use this uniform data.
*
* The data being pushed must respect std140 layout conventions. In practical
* terms this means you must ensure that vec3 and vec4 fields are 16-byte
@@ -3672,7 +3700,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline(
* The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
* SDL_CreateGPUComputePipeline().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute sampler slot to begin binding from.
@@ -3683,7 +3711,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline(
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
* \sa SDL_CreateGPUComputePipeline
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
SDL_GPUComputePass *compute_pass,
@@ -3698,7 +3726,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
* SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
* SDL_CreateGPUComputePipeline().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute storage texture slot to begin binding from.
@@ -3707,7 +3735,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
* \sa SDL_CreateGPUComputePipeline
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
SDL_GPUComputePass *compute_pass,
@@ -3722,7 +3750,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
* SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
*
* Be sure your shader is set up according to the requirements documented in
* SDL_CreateGPUShader().
* SDL_CreateGPUComputePipeline().
*
* \param compute_pass a compute pass handle.
* \param first_slot the compute storage buffer slot to begin binding from.
@@ -3731,7 +3759,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_CreateGPUShader
* \sa SDL_CreateGPUComputePipeline
*/
extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers(
SDL_GPUComputePass *compute_pass,
@@ -3903,6 +3931,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer(
* This copy occurs on the GPU timeline. You may assume the copy has finished
* in subsequent commands.
*
* This function does not support copying between depth and color textures.
* For those, copy the texture to a buffer and then to the destination
* texture.
*
* \param copy_pass a copy pass handle.
* \param source a source texture region.
* \param destination a destination texture region.

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -1392,7 +1392,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic);
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_RunHapticEffect
* \sa SDL_StopHapticEffects
* \sa SDL_StopHapticEffect
*/
extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic);

Some files were not shown because too many files have changed in this diff Show More