Commit Graph

21624 Commits

Author SHA1 Message Date
Petar Popovic
53c799a7a9 SDL_SetWindowShape(): Remove shape when argument is NULL 2026-03-26 10:42:12 -07:00
Regan Green
1d2f9f0e0e Use DSBFREQUENCY_MAX instead of hardcoded constant for DirectSound driver max frequency. 2026-03-25 20:39:19 -04:00
Clownacy
6efe0e19a7 Fix DirectSound buffer creation failure with >200kHz
Caps the sample rate at 200kHz so that SDL's mixer will downsample any streams which are higher than that.

My Mega Drive emulator outputs at 223721Hz (the sample rate of the PSG chip), and `SDL_OpenAudioDeviceStream` fails due to DirectSound's `CreateSoundBuffer` returning an 'invalid parameter' error code. Lowering the sample rate makes the error go away.

Reported to me by @B3HKO in this issue:
https://github.com/Clownacy/clownmdemu-frontend/issues/60

The 200kHz limit is documented here:
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee419022(v=vs.85)

DirectSound's Wikipedia article mentions that problems may occur with sample rates above 192kHz, but no source is provided, so I am unsure whether to take it seriously.
2026-03-25 13:23:24 -07:00
Ryan C. Gordon
dcc177faa4 emscripten: Add support for automounting persistent storage before SDL_main.
Now apps can have persistent files available during SDL_main()/SDL_AppInit()
and don't have to mess with Emscripten-specific code to prepare the filesystem
for use.
2026-03-25 14:16:07 -04:00
Anonymous Maarten
be6f1efa26 ci: clang-tools-extra is no longer available for mingw32
mingw32 and mingw64 are in the process of being deprecated
2026-03-25 18:41:00 +01:00
c4veman
8eeef53a80 Fix endmacro syntax in macros.cmake 2026-03-25 08:30:58 -07:00
nmlgc
989de77f4f render: Skip UV check when software-rendering untextured quads
Fixes a crash when calling SDL_RenderGeometryRaw() with both `texture`
and `uv` set to `NULL`, and with geometry that is laid out in a way
that passes the quad checks.
2026-03-25 07:24:55 -07:00
Green Sky
998159fa95 video: add more direct mjpeg to yuv conversions 2026-03-24 08:59:50 -07:00
Sam Lantinga
299ed51984 Added an internal hint to set OpenVR overlay flags 2026-03-23 15:23:38 -07:00
Ian Monroe
608416b5a9 support updating media name in the PipeWire backend
with this, applications can do something like this:
SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME, "current song")
and this will be reflected in the Audio Devices Plasmoid, pavucontrol etc

also cleaned up PW_KEY_MEDIA_NAME and PW_KEY_NODE_NAME; setting them to the
same appears string appears to break convention, as it results in redundant
titles in PipeWire application lists.
2026-03-23 15:26:54 -04:00
William Horvath
983e984afc windowsrawinput: Unregister/register raw input devices as necessary.
The thread is still created once and only shut down on WIN_VideoQuit,
but the thread will unregister the devices when they're disabled to avoid
wasting time processing raw input that won't be appreciated by anyone.

This also allows RIDEV_NOLEGACY to be set on the devices, otherwise they
swallow up the WM_MOUSE* events that would be going to the main thread
when relative mode is disabled. That's out of scope for this change, though.
2026-03-22 17:57:02 -07:00
William Horvath
706e7f9043 windowsrawinput: Fix incorrect INVALID_HANDLE_VALUE checks.
CreateEvent/CreateThread return NULL on failure.
2026-03-22 17:57:02 -07:00
William Horvath
00f9a25879 windowsrawinput: Add missing WIN_SetRawKeyboardFlag_Inputsink stub. 2026-03-22 17:57:02 -07:00
SDL Wiki Bot
28423eed96 Sync SDL3 wiki -> header
[ci skip]
2026-03-23 00:53:55 +00:00
Sam Lantinga
f22e088211 Clarified SDL_MostSignificantBitIndex32() documentation
Fixes https://github.com/libsdl-org/SDL/issues/15247
2026-03-22 17:52:32 -07:00
Edgar J San Martin
ad91384704 Base GCMouse raw input implementation
Fix duplicate button/scroll events when GCMouse active

Fix duplicate events and add thread-safe atomic for GCMouse

Fix GCMouse relative mode sync when connected after mode enabled

Respect SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE in GCMouse handler

Fix variable shadowing in GCMouse motion handler
2026-03-22 08:25:22 -07:00
Sam Lantinga
a48dee5ac1 Updated documentation on customizing your Android app name 2026-03-21 16:03:40 -07:00
Sam Lantinga
0f9292a367 Fixed incorrect sampler when changing Metal draw state 2026-03-21 14:08:40 -07:00
SDL Wiki Bot
3462494ec1 Sync SDL3 wiki -> header
[ci skip]
2026-03-20 18:21:04 +00:00
SDL Wiki Bot
7360a37181 Sync SDL3 wiki -> header
[ci skip]
2026-03-20 15:39:03 +00:00
SDL Wiki Bot
0e50195d37 Sync SDL3 wiki -> header
[ci skip]
2026-03-20 01:07:55 +00:00
Konstantin Tomashevich
291d1b6491 SDL_systhread.c: Remove SIGCHLD from blocked signal mask.
When SIGCHLD is blocked, some executables (for example CMake) do not exit properly when executed using `SDL_CreateProcess` from any SDL thread (not main thread). `SDL_CreateProcessWithProperties` docs say that `SIGCHILD` should not be ignored or handled, therefore blocking it during thread creation is a likely reason for the bug. Should fix #15210.

Signed-off-by: Konstantin Tomashevich <konstantin.tomashevich@gmail.com>
2026-03-18 13:10:03 -07:00
Ryan C. Gordon
b0cf826227 dynapi: Minor cleanups to library loading code. 2026-03-18 14:50:58 -04:00
sunshineinabox
6b060435e3 egl: Handle error when binding EGL API in context creation 2026-03-18 13:47:27 -04:00
Petar Popovic
55fa5e0336 SDL_dynapi.c: Unload other SDL library if initializing the jumptable fails 2026-03-18 12:49:09 -04:00
Andrei Alexeyev
ff543723c4 Fix SDL_HINT_OPENGL_ES_DRIVER interaction with SDL_HINT_OPENGL_LIBRARY for x11 and windows
If SDL_HINT_OPENGL_ES_DRIVER is enabled and a GLES context is requested,
don't try to load the WGL/GLX library. Doing so may fail, because
SDL_HINT_OPENGL_LIBRARY may have been set to a custom libGLESv2 (e.g.
ANGLE). This effectively restores the SDL2 behavior.

Other video drivers shouldn't be affected, because they always use EGL
for GLES.

Incidentally, this patch also fixes a missing GL_GetEGLSurface callback
in the X11 fallback path.
2026-03-18 12:44:48 -04:00
Frank Praznik
62af66f14a x11: More XInput2 #define cleanups
Fixes building on very old XInput2 versions (pre-2012) without smooth scrolling and multitouch.
2026-03-18 11:25:07 -04:00
Sam Lantinga
b9c227e07d Make changing raw input mode on Windows a very fast operation (take 2)
The first approach had the drawback that it accumulated handles while raw input was paused, eventually crashing the application.

Now we'll keep reading raw events from the queue, we just won't deliver them to  the application.
2026-03-17 12:56:23 -07:00
Frank Praznik
d88f76caac x11: Fix building when XInput2 is not available 2026-03-17 15:31:48 -04:00
Sam Lantinga
c717a20ec8 Fixed initial window size and placement on visionOS 2026-03-17 12:25:13 -07:00
Frank Praznik
3d21b3bc68 wayland: Scale custom cursors with the pointer scale
When emulating display modes or using display scaling, custom cursors need to be scaled, or they can appear too large or small relative to the window size.
2026-03-17 13:24:32 -04:00
Sam Lantinga
75dead7f96 Minor cleanup 2026-03-17 09:49:15 -07:00
Sanjay Govind
fdc5efe1cb add vids and pids for a variety of xbox 360 devices (#15211)
Added vids for a variety of xbox 360 devices, mostly for linux use.
Corrected wheel vid and pid being flagged as unknown. Internally, when XUSB is building vid and pids for wireless devices, it assigns 0x02a1 for devices with subtype 1 and 0x02a2 for devices with subtype 2, which are wheels.

Some of these vids and pids do rely on the following patch being merged into the linux kernel, as I have overhauled how VID and PIDs are handled there for wireless devices.
https://patchwork.kernel.org/project/linux-input/patch/20260314075034.1488655-2-sanjay.govind9@gmail.com/

Also added some lists for guitar and drum devices, so we can set controller types correctly for those controllers.
2026-03-17 09:45:26 -07:00
Sam Lantinga
43e90c7b1c Make changing raw input mode on Windows a very fast operation
Previously we would spin up and shut down a thread every time we changed raw input mode, which can take several ms. Now we'll just put the raw input thread to sleep when disabling raw input and wake it up when enabling raw input.
2026-03-16 17:19:47 -07:00
Sam Lantinga
fbc49daab7 Clarified SDL_EVENT_WINDOW_ICCPROF_CHANGED documentation (thanks @JacksonAllan!) 2026-03-16 17:14:44 -07:00
Steel
32cf5fe93d Add support for PXN VD6 Wheelbase 2026-03-16 10:51:06 -07:00
Sam Lantinga
1d081314a8 Fixed error when SDL_LoadSurface_IO() is passed a NULL src 2026-03-15 13:17:11 -07:00
Cameron Gutman
5f92aac095 windows: Fix Print Screen key capture during keyboard grab 2026-03-15 15:12:29 -05:00
Frank Praznik
8d55fbe4d2 wayland: Fix the state check when resizing a hidden window
The floating state is only set after the first configuration event arrives, so size changes before the window was initially shown could be dropped. Use the flags instead.
2026-03-15 16:03:52 -04:00
SDL Wiki Bot
5f78ded319 Sync SDL3 wiki -> header
[ci skip]
2026-03-15 10:59:52 +00:00
Sam Lantinga
46f35e6ea2 Add a necessary step for iOS app setup in Xcode 2026-03-15 01:54:28 -07:00
SDL Wiki Bot
8bf3b7215a Sync SDL3 wiki -> header
[ci skip]
2026-03-14 18:58:22 +00:00
Frank Praznik
566448d95a wayland: Eliminate redundant keyboard and mouse removals
The SDL keyboard and mouse will be removed when destroying the seat, so there is no need to preemptively remove them.
2026-03-13 22:42:09 -04:00
Sam Lantinga
69e94a4fbd Fixed warning: no previous prototype for function 'SDL_IsJoystickGameInput' 2026-03-13 17:23:54 -07:00
Rachel Blackman
ba00e772a7 Add second-gen Backbone One to recognized controllers. 2026-03-13 15:39:15 -07:00
Frank Praznik
41bce956f0 wayland: Send display moved events on display geometry changes
Updates are sent to outputs, however, dispatching the moved event was overlooked and never implemented.
2026-03-13 13:52:02 -04:00
Frank Praznik
98d23660bc wayland: Prevent overlapping outputs when using display scaling
When using the display scaling mode, scaled outputs would overlap, as the origins are in scaled points, while the width and height are in pixels. Use a simple algorithm to push the overlapping rectangles apart, so they do not overlap. This may end up leaving gaps in complex layouts (which are already somewhat mangled from mixing coordinate systems), but it works well enough in most cases.
2026-03-13 13:52:02 -04:00
Ryan C. Gordon
9f19cffc78 io: With stdio, only forbid opening directories as files.
This allows opening Unix device nodes, etc.

Fixes #15188.
2026-03-12 12:41:34 -04:00
Ryan C. Gordon
4d675f2bd3 io: Wrap IsRegularFileOrPipe in a more generic preprocessor test.
This way we can turn it off for various console platforms without changes
to this file.
2026-03-12 12:41:34 -04:00
Ryan C. Gordon
803cd7589a io: Remove iodata->regular_file check.
It wasn't used, and causes an extra fstat().
2026-03-12 12:41:34 -04:00