Commit Graph

21673 Commits

Author SHA1 Message Date
Sascha Reuter c98b36ff03 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
2026-04-06 07:19:06 -07:00
Frank Praznik 682da4ee98 misc: Use the OpenURI D-Bus portal for opening URLs
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
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.
2026-04-05 16:31:50 -04:00
SDL Wiki Bot f8feccfa46 Sync SDL3 wiki -> header
[ci skip]
2026-04-05 18:33:22 +00:00
Jesse Chounard 6f7fb0a3dc Add text input properties for on-screen keyboard customization 2026-04-05 11:31:56 -07:00
Ryan C. Gordon 1442c5a4a0 emscripten: Added more variables to PreseedEmscriptenCache.cmake.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2026-04-05 01:12:08 -04:00
Ryan C. Gordon 8b00b57468 filesystem: Rename a variable named "append" that is actually prepending.
(Strictly speaking, this was probably meant to be an "append" to the home/base
directory before the org/app name are appended to _that_, but it's definitely
added to the absolute start of the string on Emscripten, so might as well make
all of these match.

Reference PR #15262.
2026-04-05 01:08:07 -04:00
Sam Lantinga 19f70284ad Document that you can pass -1 to SDL_WaitEventTimeout() to wait indefinitely
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2026-04-04 11:36:44 -07:00
Nintorch c857861815 Add support for Oklick W-2 racing wheel controller
This PR adds the proper mapping for this racing wheel controller to comply with XInput documentation (mostly to treat the pedals as the trigger axes).
2026-04-04 10:30:57 -07:00
Peter Kokot 25aa1c643f 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.
2026-04-04 10:28:43 -07:00
Sam Lantinga fc2f4fcc22 Send SDL_EVENT_SCREEN_KEYBOARD_HIDDEN when the keyboard is hidden on Android 2026-04-04 10:07:58 -07:00
Sam Lantinga 173adc1bf6 Enable npot texture wrapping if GL_OES_texture_npot is available 2026-04-04 08:12:51 -07:00
Sam Lantinga 41c3a91079 Use the correct index for PS2 controllers
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Closes https://github.com/libsdl-org/SDL/pull/15294
2026-04-03 16:08:36 -07:00
SDL Wiki Bot 5c8714cc95 Sync SDL3 wiki -> header
[ci skip]
2026-04-03 23:03:43 +00:00
Sanjay Govind 7f86f9107d Add support for GIP guitars via gameinput (#15301) 2026-04-03 16:02:14 -07:00
foxtacles 59602fb473 (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.
2026-04-03 15:07:50 -07:00
Frank Praznik 045a127572 Add CHECK_PARAM as a conditional macro in clang-format
Otherwise, it won't be treated as a conditional expression, and clang-format will automatically move the opening brace to the line below it.
2026-04-03 11:47:41 -04:00
Sam Lantinga 5ae1308e5b Use the correct source rectangle when doing scaled blits
Fixes https://github.com/libsdl-org/SDL/issues/15309
2026-04-03 01:32:09 -07:00
nilFinx f3a3b4b95a haiku: Always assume that the URL is encoded (required on nightly) (#15305) 2026-04-03 00:01:21 -07:00
Cameron Gutman 1674a04b01 kmsdrm: Add missing KMSDRM_FBFromBO() failure check 2026-04-02 22:02:18 -05:00
Christian Semmler be8643f739 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.
2026-04-02 19:36:01 -07:00
Cameron Gutman 3c11b43e59 kmsdrm: Initialize kms_in_fence_fd to -1
Prior to this fix, we closed stdin on the first call to drm_atomic_commit().
2026-04-02 20:46:53 -05:00
Ryan C. Gordon f423a2ae34 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.
2026-04-02 20:41:26 -04:00
Sanjay Govind c58a61fdd4 Update to GameInput V3 (#15302) 2026-04-02 17:10:42 -07:00
Sam Lantinga e21f7d77f3 Fixed unaligned 16-bit memory access
The previous code technically works on platforms with SSE2, but this fixes an ubsan warning.
2026-04-02 14:08:20 -07:00
Anonymous Maarten 03f74f3ad3 testyuv: make test params static const 2026-04-02 21:25:41 +02:00
Anonymous Maarten b77fdcc638 Disable UB sanitizer in signed shift test 2026-04-02 21:25:41 +02:00
Anonymous Maarten f7661ff016 Avoid unaligned memory access while testing SSE4.2 CRC intrinsics 2026-04-02 21:25:41 +02:00
Anonymous Maarten df72e3f59d Shifting a number into the sign bit of a signed integer is UB
Shift as a unsigned number instead.
2026-04-02 21:25:41 +02:00
Anonymous Maarten 48e80c8f26 memcpy with a NULL src/dst argument is UB
malloc of UBSAN returns NULL when allocating 0 bytes, causing a call to memcpy(NULL, xxx, 0);
2026-04-02 21:25:41 +02:00
Sam Lantinga 501ee05129 Don't strip the alpha channel when scaling surfaces if it will be needed
Fixes https://github.com/libsdl-org/SDL/issues/15297
2026-04-02 11:00:17 -07:00
Sam Lantinga 156187bf58 Added a hint "SDL_SURFACE_MALLOC" to disable aligned surface allocation
This is needed for sdl12-compat, where all surfaces were not aligned.
2026-04-02 10:30:32 -07:00
Janne Virtala b5ef75249f SDL_PrivateJoystickForceRecentering(): fix infinite loop 2026-04-02 09:27:18 -07:00
Ryan C. Gordon 32ef82caaf 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.
2026-04-02 11:48:35 -04:00
Ryan C. Gordon 4d17b99d0a aaudio: Respect SDL_HINT_AUDIO_DEVICE_STREAM_ROLE hint.
Fixes #15299.
2026-04-01 22:17:23 -04:00
Sam Lantinga 6466c10ae4 Added documentation to fix building on macOS with Xcode 12.2 (thanks @buhman!)
Fixes https://github.com/libsdl-org/SDL/issues/15167
2026-04-01 16:37:14 -07:00
Sam Lantinga 8e1bdbaa92 Updated support for the GameSir Pro 8K
The latest firmware (v1.97) corrects the report frequency, and no longer reports the mute button.
2026-03-31 11:18:03 -07:00
Petar Popovic d6129d063f SDL_GlobDirectory(): Don't descend into sub-directories, if not requested by pattern 2026-03-30 16:38:39 -04:00
Ryan C. Gordon f13cd9a666 process: Don't duplicate NULL stdio handles on Windows.
It's okay to pass null handles to win32's CreateProcess().

Fixes #14977.
2026-03-30 16:22:53 -04:00
Sam Lantinga b878ab1691 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'.
2026-03-30 10:38:55 -07:00
Ryan C. Gordon 0756603e6d thread: SDL_CreateThread() shouldn't return before the new thread is set up.
Fixes #15290.
2026-03-30 10:39:17 -04:00
zn-arf e66f1b5162 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.
2026-03-30 09:30:36 -04:00
Semphris a54dd7ba45 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.
2026-03-29 02:05:33 -04:00
Sam Lantinga 815fd4bf45 Removed spurious whitespace 2026-03-28 22:22:39 -07:00
Ryan C. Gordon a157d96de8 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.
2026-03-28 11:18:03 -04:00
Frank Praznik 1df279a04f x11: Look for text/uri-list in the list of MIME types more thoroughly
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
A uri-list of files is the preferred format, so don't bail if a preferred text format is encountered first.
2026-03-27 12:21:40 -04:00
Sam Lantinga 995d4e10a6 Added documentation for getting the full resolution in iOS 2026-03-27 08:43:30 -07:00
Sam Lantinga 122ad3d6f6 Added SDL_IsPhone() 2026-03-27 05:45:36 -07:00
Strultz 6a9449c098 Fix window caption drawing on borderless windows (#15275) 2026-03-27 05:14:19 -07:00
c4veman 159bba9aa1 Check Windows version before setting window attributes
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2026-03-26 10:43:52 -07:00
Petar Popovic 53c799a7a9 SDL_SetWindowShape(): Remove shape when argument is NULL 2026-03-26 10:42:12 -07:00