Commit graph

13159 commits

Author SHA1 Message Date
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
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
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
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
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
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
ShulkerSakura
1d228f8a7d Add keychron Q3 blacklist (#15462)
(cherry picked from commit 543a05bf08)
2026-04-26 07:45:43 -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
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
604a4dfa69 atomic: Use acquire/release InterlockedExchange intrinsics on ARM64EC
(cherry picked from commit 0220a41a2e)
2026-04-24 19:01:31 -05:00