Commit Graph

13110 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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