Commit graph

18557 commits

Author SHA1 Message Date
Ozkan Sezer
6fa6297441 fix typo from commit b84f150d06 2024-12-17 11:15:56 +03:00
Ozkan Sezer
b84f150d06 fix macOS builds with hidapi disabled
Fixes: https://github.com/libsdl-org/SDL/issues/11647 .
2024-12-17 11:11:56 +03:00
SDL Wiki Bot
c52a96ca8e Sync SDL3 wiki -> header
[ci skip]
2024-12-17 07:29:13 +00:00
Sam Lantinga
080b3002c6 Fixed building with an older Windows SDK 2024-12-16 22:33:31 -08:00
Ryan C. Gordon
d0d1414836 messagebox: Copy title and message up front, to protect SDL_GetError() strings.
It's possible (likely!) someone could just pass a pointer returned by
SDL_GetError for one of these strings, but the message box code has to do a
ton of complicated stuff that might _also_ call SDL_SetError, so you could
end up with the string having different contents by the time you display it.

Just make a copy of the strings unconditionally at the start, so they're safe
no matter where they came from.

Fixes #10932.
2024-12-16 21:58:05 -05:00
SDL Wiki Bot
a92eade183 Sync SDL3 wiki -> header
[ci skip]
2024-12-16 17:20:27 +00:00
Ryan C. Gordon
0bb42cb023 alsa: a few more minor formatting tweaks. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
483ceb5355 alsa: Reenable SDL's internal channel map support when ALSA can't swizzle. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
35360ec4d7 alsa: Use more hints for opening default devices. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
576f13ac7c alsa: Put debug logging back into correct category and logging level. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
ff96c59df4 alsa: Add back in code to guess the correct ALSA device prefix. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
b108b54c6a alsa: Bring up to current SDL coding conventions and standards, other tweaks. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
639855b7e5 alsa: Remove direct calls to memset 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
a4a1dff219 alsa: remove loop macro 2024-12-16 12:19:48 -05:00
Ryan C. Gordon
b9c062c858 alsa: Pulled in latest changes from @sylware 2024-12-16 12:19:48 -05:00
Sam Lantinga
76e7bc4c04 Added support for ALSA dmix audio output (thanks @sylware!)
Fixes https://github.com/libsdl-org/SDL/issues/8577
2024-12-16 12:19:48 -05:00
SDL Wiki Bot
3fa0537565 Sync SDL3 wiki -> header
[ci skip]
2024-12-16 06:13:48 +00:00
Ryan C. Gordon
79316ca36e
Heavy work on improving category documentation.
Still more to go!

Reference Issue #9440.
2024-12-16 01:10:37 -05:00
SDL Wiki Bot
9aca97f4e7 Sync SDL3 wiki -> header
[ci skip]
2024-12-16 05:03:54 +00:00
Ryan C. Gordon
c0803f7683
SDL_dialog.h: Improvements and fixes to the documentation. 2024-12-16 00:02:50 -05:00
Ryan C. Gordon
a55686ce61
hints: Clarify when joystick hints should be set.
Fixes #9490.
2024-12-15 21:28:28 -05:00
Frank Praznik
eb3fc0684c wayland: Don't close an externally owned display on init failure 2024-12-15 10:51:51 -05:00
L zard
6cc9ce183d SDL_internal: remove #undef SDL_LEAN_AND_MEAN
I am confused by the "You have to manually edit this file" comment. Does it mean that it is expected to manually remove the previous `#define SDL_LEAN_AND_MEAN 0` ?
In any case I put this part of the change in a separate commit so that it can easily be reverted.
2024-12-14 09:22:29 -08:00
L zard
8b6d3c88cf Fix #ifdefs to have config flags either defined as 1 or undefined
See 387774ab8a
2024-12-14 09:22:29 -08:00
Frank Praznik
313d522f39 wayland: Only require fifo-v1 for Wayland by default
Some compositors may not implement commit-timing-v1 in addition to fifo-v1, at least not immediately, and Mesa doesn't require commit-timing for FIFO behavior. The fifo-v1 protocol alone is enough for the desired behavior.

Only check for fifo-v1 to enable Wayland by default.
2024-12-13 18:40:34 -05:00
Ryan C. Gordon
ac2edad809
audio: Simplify and unify audio stream format updating when devices change.
This used to do different things for recording streams in different parts of
the codebase, not to mention two separate codepaths through
UpdateAudioStreamFormatsPhysical in any case. My hope is this should kill off
a few corner case bugs...for example, this one:

Fixes #8402.
2024-12-13 14:59:16 -05:00
Ryan C. Gordon
9a9616894d
wikiheaders: Fix uninitialized variable issue. 2024-12-13 13:52:35 -05:00
Ethan Lee
9628549c7c Xbox buildfixes 2024-12-13 11:34:39 -05:00
Ryan C. Gordon
80b9986418
audio: Fixed potential NULL dereference.
This could happen if you call SDL_BindAudioStreams() when the subsystem isn't
initialized, and possibly in other corner cases.

Thanks to Qianxin CodeSafe Team, @QiAnXinCodeSafe, for discovering this issue!

Fixes #11643.
2024-12-13 10:12:33 -05:00
Sam Lantinga
1944bc7407 Fixed warning C4702: unreachable code 2024-12-12 15:43:42 -08:00
Sam Lantinga
63a498c966 Fixed warning C4189: 'cqe': local variable is initialized but not referenced 2024-12-12 15:43:07 -08:00
Sam Lantinga
ce9dddfde2 Don't free properties while modifying the property hashtable
A property cleanup callback might end up trying to set other properties, so we don't want to have a lock held at that point.

Fixes an assertion in testprocess when cleaning up IO stream properties
2024-12-12 14:39:53 -08:00
Sam Lantinga
43a61fec91 Removed external hashtable locking functions
Read-write locks are not recursive and can't be upgraded from one type to another, so it's not safe to lock the hash table and then call functions that operate on it. If you really want this functionality, we'd need to create unlocked versions of the hashtable functions and you would call those once you've taken a lock on the hashtable, and we'd have to assert that the operations you're doing are compatible with the type of lock you've taken.

All of that complicates working with hashtables, so if you need that type of access, you should probably just use external locking.
2024-12-12 14:39:53 -08:00
Sam Lantinga
61511c48a4 SDL_HashTable is now optionally thread-safe
Fixes https://github.com/libsdl-org/SDL/issues/11635
2024-12-12 14:39:53 -08:00
Ryan C. Gordon
e0cee83a3a
emscriptenaudio: Removed comment about Firefox not supporting userActivation.
It does now, and has since Firefox 120 (around November 2023).
2024-12-12 10:48:23 -05:00
Ryan C. Gordon
2635239bbc
README-migration: some improvements to the audio section.
Minor edit about default devices, and an explanation of forcing device buffer
size with SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES.

Fixes #9857.
2024-12-12 01:29:56 -05:00
Marcin Serwin
ce7cb10541 dialog/unix: create zenity argv on the main thread
Creating `argv` for zenity means we don't have to pass the building
blocks between threads which allows us to avoid deep copying some nested
structures. It also allows us to fail earlier in case of problems with
building the argument vector.
2024-12-11 20:57:07 -08:00
Marcin Serwin
cf59fc797f dialog/unix: deep copy args to avoid data race
SDL properties passed to the `SDL_Zenity_ShowFileDialogWithProperties`
may be destroyed/modified immediately upon the function return.
Therefore, we must copy all the strings and structures passed via
pointers; otherwise, the `SDL_ZenityFileDialog` thread attempting to
read them will cause data race.
2024-12-11 20:57:07 -08:00
Marcin Serwin
af6c641b8c dialog/unix: stricter typing
Introduce `const` where appropriate
2024-12-11 20:57:07 -08:00
Marcin Serwin
4c86511035 dialog/unix: reduce string allocations
Simplifies logic of spawning the zenity process by avoiding allocations
of static strings
2024-12-11 20:57:07 -08:00
Marcin Serwin
ff82238172 dialog/unix: remove /usr/bin/env indirection
SDL process is using `posix_spawnp` which already does the path lookup
so additional indirection via `env` is unnecessary
2024-12-11 20:57:07 -08:00
cosmonaut
c5acbef3bf GPU: Fix D3D12_INTERNAL_StrToWStr returning incorrect length 2024-12-11 16:38:28 -08:00
Ryan C. Gordon
6fe09e3aa4
dynapi: Minor optimization to SDL_SetError wrapper. 2024-12-11 18:04:43 -05:00
SDL Wiki Bot
a1e8d5c327 Sync SDL3 wiki -> header
[ci skip]
2024-12-11 19:17:12 +00:00
Evan Hemsley
3ee39f6c3f
GPU: Revise swapchain acquisition (#11633)
---------

Co-authored-by: Lucas Murray <22484+lmurray@users.noreply.github.com>
2024-12-11 11:16:35 -08:00
Ryan C. Gordon
bbd4eeb287
examples/audio/04-multiple-streams: Note about web browser audio in README. 2024-12-11 14:13:52 -05:00
Ryan C. Gordon
f45ce45603 ngage: Remove Nokia N-Gage support.
This can be reverted if a toolchain arrives that can handle C99 features like
variables declared in the middle of a scope, but for now we literally can't
compile SDL3 for this platform.

Fixes #11243.
2024-12-11 13:29:43 -05:00
Ryan C. Gordon
3f425b6f20
examples/audio/04-multiple-streams: Patched to compile on Visual Studio. 2024-12-11 13:25:43 -05:00
Ryan C. Gordon
1fbb8e1824
examples/audio/04-multiple-streams: Remove drag-and-drop support.
I'm going to reuse that code for an actual drag/drop example later, but for
simplicity and accessibility of the examples, this is just going to load two
wavs and loop them, so you get the music with a sword-clinking sound mixed
over it.
2024-12-10 23:10:43 -05:00
SDL Wiki Bot
e6e468d0c4 Sync SDL3 wiki -> header
[ci skip]
2024-12-11 00:28:23 +00:00