Commit Graph
4669 Commits
Author SHA1 Message Date
Ryan C. Gordon fff3d3516e thread: Added SDL_GetCurrentThreadName().
Fixes #15919.
2026-11-12 14:35:18 -05:00
Frank Praznik 9d78aca3bb events: Don't leave the clipboard in an unknown state when SDL_SetClipboardData() fails
Previously, a failure of SDL_SetClipboardData() would leave the clipboard in an unknown state, as the degree to which the internal state was cleaned up depended on where in the process the failure occurred: the clipboard may have been cleared and completely reset, or it may have reported failure while the backend continued to hold references to the passed parameters.

Clear the clipboard consistently when the setting process fails, so callers can be ensured that no references to their data remains held. In the case of early failure, the cleanup function, if any, will still be called to ensure consistency.
2026-11-10 15:07:09 -05:00
SDL Wiki Bot f599b192f0 Sync SDL3 wiki -> header
[ci skip]
2026-11-10 02:31:59 +00:00
Sam Lantinga a00b14fee2 Enable completely asynchronous controller detection and updates if SDL_HINT_JOYSTICK_ASYNC is set
You can also set the asynchronous polling interval using SDL_HINT_JOYSTICK_ASYNC_UPDATE_INTERVAL if you'd like it separate from the event loop update frequency.

Fixes https://github.com/libsdl-org/SDL/issues/15403
2026-11-09 18:31:22 -08:00
SDL Wiki Bot 531acc0a76 Sync SDL3 wiki -> header
[ci skip]
2026-11-09 17:47:01 +00:00
Sam Lantinga 7b82a40bbf Added a container ID property to controllers and audio devices
This allows matching up controllers and their associated audio devices, e.g. DualSense controllers and their associated haptic audio endpoint.

Fixes https://github.com/libsdl-org/SDL/issues/9197
2026-11-09 09:46:26 -08:00
SDL Wiki Bot fb4a01f507 Sync SDL3 wiki -> header
[ci skip]
2026-11-09 00:27:26 +00:00
Sam Lantinga 4855e967c8 Fix the default location for portal file dialogs
Also clarify how the default location is interpreted.

Fixes https://github.com/libsdl-org/SDL/issues/14876
2026-11-08 16:26:27 -08:00
SDL Wiki Bot 359933aab0 Sync SDL3 wiki -> header
[ci skip]
2026-11-08 23:53:36 +00:00
Sam Lantinga 08d976eb2f A folder dialog always treats the location as a folder 2026-11-08 15:53:00 -08:00
SDL Wiki Bot 9bcf4465e1 Sync SDL3 wiki -> header
[ci skip]
2026-11-08 21:26:46 +00:00
Sam Lantinga cec679bb7c Make sure we pass -1 for the filter if a file dialog is canceled 2026-11-08 13:25:43 -08:00
SDL Wiki Bot c58854d6a7 Sync SDL3 wiki -> header
[ci skip]
2026-11-05 21:09:06 +00:00
Ryan C. Gordon 10d6488786 audio: Adjust some device-opening hints.
- They now work when the app specifies a NULL spec (verses a spec with zero'd
  fields).
- They now favor the hint, falling back to the device's default settings
  (before they would fall back to `DEFAULT_AUDIO_*` defines, but it's better
  to default to what the hardware natively offers, and if the device doesn't
  specify a default, they'll be set to those defines earlier anyhow). This
  uses `device->default_spec` instead of `device->spec` so if something opens
  the device at a low-quality, it doesn't force all future default opens to
  conform to it.
- Hint docs now explain this.

Fixes #16652.
2026-11-05 16:05:16 -05:00
Sam Lantinga f96e02d6de Split the joystick lock and the event lock
This prevents joystick activity on a separate thread from blocking input processing on the main thread.

One side effect of this is that joystick events need to be dispatched while the joystick lock isn't being held, to prevent deadlocks if an event watcher calls a joystick function. To handle this, joystick events for the current update are sent all at once at the end of the joystick update while the joystick lock is no longer held.

The joystick and sensor subsystems call into each other, so they share the same lock and sensor events are queued and dispatched similarly.
2026-11-02 13:11:48 -08:00
Sam Lantinga d307ae547c Simplification assuming no separate joystick thread 2026-11-02 11:25:16 -08:00
Sam Lantinga 81b4769b0e Removed the WGI and RAWINPUT joystick drivers
These are functionally replaced by GameInput and are not enabled by default due to various limitations.
2026-10-30 11:00:38 -07:00
Frank Praznik 01636817f9 thread: Use the monotonic clock for pthread condition and semaphore waits when possible
Use pthread_condattr_setclock() and sem_clockwait() when available, so that wait operations will be timed against the monotonic clock. This avoids potential hangs if the realtime clock experiences a discontinuity.
2026-10-29 13:03:37 -04:00
Ryan C. Gordon dac33b4369 audio: SDL_AUDIO_FRAMESIZE "returns" an unsigned int.
Otherwise, this macro would always trigger a `-Wsign-conversion` warning,
since it multiplies an unsigned int by a signed int.

Fixes #16539.
2026-10-25 16:04:49 -04:00
SDL Wiki Bot aa73ededf6 Sync SDL3 wiki -> header
[ci skip]
2026-10-25 19:19:13 +00:00
Ryan C. Gordon 8be6db493e SDL_keyboard.h: add notes about threading vs SDL_GetKeyboardState.
Fixes #16562.
2026-10-25 15:18:01 -04:00
Antti Ala-Fossi 9c31e40437 Add support for R10G10B10A2_UNORM vertex format 2026-10-24 08:57:21 -07:00
SDL Wiki Bot 7080301cf8 Sync SDL3 wiki -> header
[ci skip]
2026-10-16 23:51:02 +00:00
Sam Lantinga 4dad7ef04d Added SDL_SetRenderHDRHeadroom() and SDL_GetRenderHDRHeadroom() 2026-10-16 16:46:37 -07:00
Sam Lantinga a35ab714f3 Updated documentation for HDR properties 2026-10-16 16:46:37 -07:00
SDL Wiki Bot d4557c1511 Sync SDL3 wiki -> header
[ci skip]
2026-10-14 02:16:54 +00:00
Ryan C. Gordon 507179ee74 misc: Added SDL_EncodeURL.
Fixes #16254.
2026-10-13 22:16:04 -04:00
Sam Lantinga 28e2e77125 Added SDL_SetSoftwareRendererWindow() and SDL_SetSoftwareRendererSurface()
You can now create a software renderer with a NULL surface and set the surface later.

Fixes https://github.com/libsdl-org/SDL/issues/16459
2026-10-09 08:17:52 -07:00
Sam Lantinga e9bc23196e Added support for 2-plane external NV12 textures to the Vulkan renderer 2026-10-08 09:32:04 -07:00
Ryan C. Gordon b4c0634fef main: Call SDL_AppQuit() if SDL_EVENT_TERMINATING fires.
We had logic to do this, but due to the nature of iOS, we never actually
called it because the process terminated before we could. This was likely
true on Android, HarmonyOS, and Emscripten, too, so this adds a new interface
that various platforms can use as appropriate when the event fires.

The generic implementation just attempts to set apprc to success, which will
result in normal process termination, including calling SDL_AppQuit(), which
matched current behavior, but to be fair, all the platforms that use the
generic backend shouldn't ever fire this event.

When calling SDL_AppQuit() due to SDL_EVENT_TERMINATING, the other backends
leave the SDL_AppResult as SDL_APP_CONTINUE (assuming SDL_AppEvent() didn't
respond to SDL_EVENT_TERMINATING by returning a terminating result), so that
SDL_AppQuit() has a signal that they have arrived at termination in an unusual
way, instead of the app explicitly requesting it.

Fixes #16457.
2026-10-08 11:20:27 -04:00
SDL Wiki Bot e4af6f8e28 Sync SDL3 wiki -> header
[ci skip]
2026-10-07 13:38:36 +00:00
Ryan C. Gordon 6c518525ac audio: Added notes about the risks of SDL_LockAudioStream vs the device lock.
Fixes #16362.
2026-10-07 09:37:40 -04:00
SDL Wiki Bot 21528641fc Sync SDL3 wiki -> header
[ci skip]
2026-10-05 19:01:42 +00:00
Ryan C. Gordon 008dd4195b docs: Corrections and improvements to Locale documentation. 2026-10-05 15:00:21 -04:00
Sawkez 659ec63b2e PS2: allow setting framebuffer color depth (#16442) 2026-10-04 11:29:01 -07:00
Ryan C. Gordon 9780425540 events: Send pen device type with each event.
It's the only thing you would need to query with an external function, and the
pen ID could be invalid by the time you run the event queue, so it's easier to
just include it with the events.

Fixes #16316.
2026-10-01 15:03:47 -04:00
Ryan C. Gordon a19bac6521 docs: Don't put SDL_main_impl.h in the "Main" wiki documentation category.
Nothing in here has public API documentation (intentionally), and since it's
in the same category as SDL_main.h, it would overwrite its function-order list,
causing the "Main" section to be dropped from the Quick Reference pages.
2026-09-26 00:15:53 -04:00
SDL Wiki Bot fef0d2440f Sync SDL3 wiki -> header
[ci skip]
2026-09-24 23:56:20 +00:00
svncibrahim 5d7167cbc9 wayland: Add opt-in border inset window properties
Applications drawing client-side decorations (shadows, invisible resize borders) can declare their insets via four new window properties. SDL sets the xdg geometry to the surface minus the insets and translates configure sizes, size limits and popup positioning accordingly. All-zero insets (the default) leave protocol traffic unchanged; the configure-size dedup becomes state-aware so a maximize/fullscreen toggle at unchanged dimensions is re-adopted rather than skipped.
2026-09-24 12:39:25 -04:00
DoubleHypercube ef03183d83 Add support for Sun 'Front' key 2026-09-22 09:39:12 -07:00
Petr Šácha e93ec0bdce pixels: truncate SDL_SetPaletteColors input array silently 2026-09-21 11:16:44 -07:00
Ryan C. Gordon 0ccb0bf626 audio: Added SDL_GetAudioDeviceProperties() and a unique-id property for it.
In addition to adding properties to audio devices, the new property,
`SDL_PROP_AUDIO_DEVICE_UNIQUE_ID_STRING`, allows a best-effort option to find
the same specific audio device used on a previous run of a program, even in an
imperfect way. Most backends don't support this, but CoreAudio on macOS and
IMMDevice on Windows can.

coreaudio: Rework device enumeration queries, acquire unique_id.

- No longer keeps multiple AudioObjectPropertyAddress objects, just change the
  selector for each query.
- Move string retrieval for AudioObjectProperties off to a separate function.
- Query for unique_id.
- If a device name is blank, don't reject the device, try to come up with a
  name of some sort (either the unique_id or "Unnamed audio device").

windows: Add unique audio device identifiers to IMMDevice support.

This uses the new "StableId" property on Windows 11 if available, and the
device id (IMMDevice::GetId()) otherwise.

Microsoft claims that GetId() remains valid between reboots and even
disconnecting and reconnecting the audio device (although I am dubious that is
universally true when plugging into a different USB port, etc), but driver and
OS updates might change the identifier. StableId goes further, promising that
software updates won't change it, either.

This adds support to our WASAPI and DirectSound backends, if you're on at
least Windows Vista. Windows XP will not offer a unique ID for devices.

Fixes #16258.
2026-09-21 10:16:37 -04:00
SDL Wiki Bot a6c68172be Sync SDL3 wiki -> header
[ci skip]
2026-09-19 15:54:32 +00:00
Ryan C. Gordon a24429c192 harmonyos: Port SDL3 to HarmonyOS/OpenHarmony.
This is my port of SDL3 to HarmonyOS/OpenHarmony. It has been tested on real
hardware from Huawei, and commercial games are being prepped to ship with it
already.

There is _heavy_ documentation in docs/README-harmonyos.md, including how to
set up a development environment and project, build, and debug, for the
completely uninitiated.

This work was sponsored by Outfit7: https://outfit7.com/

Fixes #9837.
2026-09-15 12:33:00 -04:00
Ryan C. Gordon 570f72297b docs: Fix default behavior description for SDL_PROP_APP_METADATA_NAME_STRING.
Fixes #16317.

(cherry picked from commit ddba673cdd)
2026-09-14 16:13:01 -04:00
Evan Hemsley 1a2ba3b94d GPU: Allow multisample textures to be read (#15838) 2026-09-14 12:12:41 -07:00
Sam Lantinga 33b4a9d915 Added floating point versions of cliprect and viewport render functions
Fixes https://github.com/libsdl-org/SDL/issues/14654
2026-09-13 11:45:06 -07:00
Ryan C. Gordon b290793b78 stdinc: On Windows, uppercase the system environment table's var names.
Fixes #15086.
2026-09-13 10:47:29 -07:00
Sam Lantinga 5b02b2217c Added SDL_PROP_WINDOW_CREATE_WIN32_STYLE_EX_NUMBER 2026-09-13 10:45:21 -07:00
Sam Lantinga 26b37f5d1c Perform Vulkan YUV color conversion explicitly in shaders
This makes the Vulkan code match the D3D/Metal/GPU renderers, and avoids bugs and unsupported format/sampler combinations on various vendor's drivers (including NVIDIA!)
2026-09-12 12:25:38 -07:00