Commit Graph
100 Commits
Author SHA1 Message Date
Ryan C. Gordon bc17a8922b emscripten: Allow SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT to be toggled on a window.
Fixes #14567.
2025-12-04 15:39:47 -05:00
Ryan C. Gordon 505cd6cd22 testautomation_video: Don't do fullscreen toggling tests on Emscripten.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
SDL_SetWindowFullscreen now reports failure while a fullscreen transition is
already in progress on Emscripten, upsetting the test when it tries to come
back to windowed mode, but testautomation will never give correct results here
even when we fix the backend to queue pending reversal requests, because
you'll have to return to the Emscripten mainloop before these state changes
will occur.

It's just sort of luck this specific test passed before on this target.
2025-12-02 14:36:27 -05:00
Ryan C. Gordon 737be31c63 emscripten: Prevent fullscreen transitions while one is already in progress.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes #14533.
2025-12-01 23:33:30 -05:00
Ryan C. Gordon c1db2b4bb0 Revert "hints: Added SDL_HINT_AUDIO_ENFORCE_MINIMUM_SPEC."
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Revert "Sync SDL3 wiki -> header"

This reverts commits b7c8b2f29a and
29213efa65.
2025-12-01 14:39:48 -05:00
unknown b7c8b2f29a hints: Added SDL_HINT_AUDIO_ENFORCE_MINIMUM_SPEC.
Fixes #14426.
2025-11-30 23:26:02 -05:00
Ryan C. Gordon 21f93e127b wikiheaders: generalize some previously-SDL-specific things
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Now other projects can use it with their headers, if they provide an options
file with specifics and are willing to follow some SDLish header conventions.

This shouldn't affect SDL satellite projects, etc, since they literally use
the SDL symbols, like `SDLCALL` and such, which are the defaults in the script
if a .wikiheaders-options file doesn't override them.
2025-11-25 23:14:31 -05:00
Ryan C. Gordon 9b348ef6e8 android: Better parsing of command line arguments.
Reference Issue #14510.
2025-11-25 15:29:48 -05:00
Ryan C. Gordon da863ff5f9 uikit: Don't copy argv; the original lives the whole time we need it.
Reference Issue #14510.
2025-11-25 15:29:31 -05:00
Ryan C. Gordon 4e79d2ad64 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.
2025-11-24 23:56:04 +03:00
Ryan C. Gordon 7f0d0d0046 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.
2025-11-24 13:37:10 -05:00
Ryan C. Gordon 1fdc7975cb visualc: Fixed corrupted SDL.vcxproj.filters file.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes #14526.
2025-11-24 10:34:08 -05:00
Ryan C. Gordon 15f98b2a61 blit: Change ifdefs on NEON functions that use an aarch64-specific opcode.
Fixes #14519.
2025-11-24 10:32:30 -05:00
Ryan C. Gordon 17ab859907 main: Unify command line handling between standard Windows and GDK targets.
Reference Issue #14510.
2025-11-24 10:04:09 -05:00
Ryan C. Gordon ff44bad9bd main: Restored lost call to SDL_SetMainReady() in Windows SDL_RunApp().
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2025-11-24 01:39:34 -05:00
Ryan C. Gordon a37d3f96f4 main: SDL_RunApp now explicitly handles NULL argv in all implementations.
It'll usually replace it with `{ "SDL_app", NULL }`, but things like Win32
can query the OS for the original command line arguments.

This allows apps/scripting languages that provide their own entry points to
use SDL_RunApp and not have to worry about how to compose an argv array on
things like Windows, when SDL was going to do it for them anyhow.

Most things won't experience any change with this commit, including apps that
that want extra control but originate in a standard main()-style entry point
and can just pass the existing argc/argv through to SDL_RunApp.

Windows isn't addressed here, since a previous commit already updated it.
GDK has a different fix here, but we'll unify that in a later commit.

Closes #12676.
2025-11-23 23:38:41 -05:00
Ryan C. Gordon 7d5ec38953 main: Restore MINGW32_FORCEALIGN to SDL_RunApp on Windows.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2025-11-23 17:05:31 -05:00
Ryan C. Gordon 7388054fa2 main: Restore public domain comment in Windows code.
This, strictly speaking, doesn't _need_ to be public domain any more, since
SDL3 no longer inserts this code into apps via a static SDL_main library; it's
just part of the normal zlib-licensed SDL library and called into through a
well-defined entry point at startup, now.

But removing a public domain notice isn't the done thing, so we'll leave it in.

(To a related point: even if others have rewritten good portions of this code,
they're doing it under the assumption that this specific file has a public
domain license.)
2025-11-23 13:41:08 -05:00
Ryan C. Gordon 029746a3d4 README-emscripten: Added some initial notes about customizing index.html.
Fixes #14485.
2025-11-21 10:25:34 -05:00
Ryan C. Gordon 62a7ac507a README-emscripten: updated notes on audio.
This still had a bunch of text that wasn't updated for SDL3's ability to deal
with pre-user-interaction pages. Same idea, but changed text that suggested
you have to wait to open the audio device.
2025-11-21 10:12:53 -05:00
Ryan C. Gordon 22df7c66ed wikiheaders: Treat docs/INTRO-* files the same way as the README files.
Closes #14261.
2025-11-21 09:36:56 -05:00
Ryan C. Gordon 0f76744828 pen: Updated documentation to meet current expectations and realities. 2025-11-21 08:13:16 -05:00
Ryan C. Gordon 3dee60d65f pen: Only allow one pen on Emscripten.
Same deal as the current Windows code: this "fixes" proximity but limits you
to a single pen device. But this is probably okay for most reasonable use
cases.
2025-11-21 08:13:16 -05:00
Ryan C. Gordon 06583ce421 pen: Only allow one pen on Windows.
This "fixes" proximity but limits you to a single pen device. But this is
probably okay for most reasonable use cases.
2025-11-21 08:13:16 -05:00
Ryan C. Gordon 99d7dad7e6 pen: Dramatic improvements to proximity information.
Now everything will attempt to track pens through proximity changes (instead
of removing the pen entirely). testpen.c has been updated to reflect this.

Some platforms and devices are better at this than others, but this seems like
a significant usability improvement across the board.

Fixes #12992.
2025-11-21 08:13:16 -05:00
Ryan C. Gordon 0cc3354731 wayland: Fixed pen button input (was losing button up events). 2025-11-21 08:13:16 -05:00
Ryan C. Gordon 3ae7a54c94 filesystem: SDL_OpenFileStorage() now deals with relative paths better.
Fixes #13484.
2025-11-15 11:29:37 -08:00
Ryan C. Gordon b83bd80424 Update README.md 2025-11-15 11:29:37 -08:00
Ryan C. Gordon 10f6b860ee Create FUNDING.yml 2025-11-15 11:29:37 -08:00
Ryan C. Gordon d62f141b29 opengl: Fixes for sRGB framebuffer support.
This changes the default for SDL_GL_FRAMEBUFFER_SRGB_CAPABLE to -1 (for
"don't care"). Minor ABI break, but technically this never worked correctly.

Fixes #13055.
2025-11-14 15:40:25 -05:00
Ryan C. Gordon 367c8d7c7b touch: don't compare mouse_touch_events to zero; it's a bool. 2025-11-14 10:28:16 -05:00
Ryan C. Gordon d66946cee7 wasapi: fix memory leak on unlikely failure case. 2025-11-13 20:58:21 -05:00
Ryan C. Gordon 7db0e48454 wasapi: Minor style tweaks. 2025-11-13 20:58:21 -05:00
Ryan C. Gordon 25ab8c99df pen: Offer the current window during promixity events on most platforms.
Fixes #12356.
2025-11-11 16:34:22 -05:00
Ryan C. Gordon 2382d3831c cmake: List enabled camera backends. 2025-11-09 12:05:05 -05:00
unknown b9c790949e wasapi: Don't ignore device disconnect events on unopened devices.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Reference Issue #13317.
2025-11-09 01:15:45 -05:00
Ryan C. Gordon 2f41dd7b5c pen: Better pen position precision on Windows 8 and later.
Fixes #12084.
2025-11-09 00:46:45 -05:00
Ryan C. Gordon f8a959da05 cmake: Add some symbols to the Emscripten preseed cache. 2025-11-06 13:41:55 -05:00
Ryan C. Gordon 720a9d0636 README-emscripten: Note that using the latest stable release is a good idea. 2025-11-05 16:12:01 -05:00
Ryan C. Gordon 7324823b3e emscripten: Send resize events when screen orientation changes.
The canvas _might_ be changing sizes, if you've set up your own CSS for it, or
are using SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT.

Reference Issue #7359.
2025-11-05 15:52:38 -05:00
Ryan C. Gordon a0fa64a91c wikiheaders: Don't ignore macro symbols that are defined without any content.
Reference PR #12676.
2025-10-25 15:05:36 -04:00
Ryan C. Gordon 801889dafa assert: Allow SDL_FILE (and the new SDL_ASSERT_FILE) to be overridden.
This allows changing out `__FILE__` in general and the file path reported in
SDL_assert specifically to not leak build machine path info, or just simply
not include the absolute path if you swap it out with `FILE_NAME` on Clang/GCC.

Fixes #14290.
2025-10-23 16:11:35 -04:00
Ryan C. Gordon 7bff05402a endian: use TinyCC-compatible output operands for SDL_Swap16.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Closes #14300.
2025-10-23 11:28:46 -04:00
Ryan C. Gordon 2056c54548 kmsdrm: Allow windows to be marked as "unfocusable".
In this case, it means a newly-created window on a specific display won't
get mouse/keyboard input (which, presumably, will continue to go to a window
on a different physical display instead).

This also makes SDL_SetWindowFocusable() functional on the kmsdrm backend, to
change this flag later, but to be clear, there are no window focus events to
jump between displays in this backend, so this is only useful to manually
tweak things later.

Fixes #14289.
2025-10-21 14:10:49 -04:00
Ryan C. Gordon 91a5598283 cocoa: Check for duplicate proximity events.
Fixes #12137.
2025-10-20 15:55:24 -04:00
Ryan C. Gordon f999d8d99f README-emscripten: Added a note about how the 2D API handles vsync differently.
Reference PR #13962.
2025-10-20 12:35:52 -04:00
Ryan C. Gordon 1fe926769c kmsdrm: Restore atomic support. 2025-10-19 14:22:56 -04:00
Ryan C. Gordon 48b5da67f4 README-switch.md: Updated to mention Switch 2. 2025-10-14 14:18:35 -04:00
Ryan C. Gordon 55167402f4 pen: Improved docs for SDL_PenDeviceType. 2025-10-14 14:07:08 -04:00
Ryan C. Gordon 4ece6993fe uikit: Apple Pencil is always a "direct" input device.
Fixes #13065.
2025-10-14 13:59:27 -04:00
Ryan C. Gordon 72a3e4084a testsymbols: Use the existing symbol list in SDL_dynapi_procs.h 2025-10-13 10:58:03 -04:00
Ryan C. Gordon f767809e25 docs: A few minor improvements to the GL context creation docs. 2025-10-13 01:39:03 -04:00
Ryan C. Gordon c508239e91 emscripten: Add a stub SetWindowResizable implementation.
This is needed or SDL_SetWindowResizable won't let you change the window's
SDL_WINDOW_RESIZABLE flag.

Fixes #12405.
2025-10-11 11:46:15 -04:00
Ryan C. Gordon f556027e15 hints: Remove SDL_HINT_DEBUG_LOGGING.
This now just needs generic debug-level logging enabled, for example:

```bash
SDL_LOGGING=debug ./test/testsprite
```

Fixes #13425.
2025-10-10 21:55:48 -04:00
Ryan C. Gordon 6ab212bd13 cpuinfo: Include unistd.h for getpagesize() support, too. 2025-10-10 21:52:41 -04:00
Ryan C. Gordon f7d5bb3c7a cpuinfo: Added SDL_GetSystemPageSize.
Fixes #14201.
2025-10-10 21:16:10 -04:00
Ryan C. Gordon 1191f81a3c camera: Make refcounts more robust, and actually destroy disconnected cameras.
Fixes #14049.
2025-10-10 16:21:59 -04:00
unknown 5fb2bda549 windows: Use WGL instead of EGL if extension available, even with GLES1.
Also broke this unwieldy line of code up into several.

Fixes #13056.
2025-10-09 14:05:06 -04:00
unknown 84981ead73 docs: Note that Windows might block SDL_PollEvent() on window drag.
Reference Issue #13435.
2025-10-09 13:41:49 -04:00
Ryan C. Gordon ef1d4ed1bf windows: Allow OpenGL ES creation without EGL, if the WGL supports it.
Note that this should work with GLES1, don't let the "es2" in
WGL_EXT_create_context_es2_profile fool you.

Fixes #13056.
2025-10-09 13:07:57 -04:00
Ryan C. Gordon 09bd8e8a5a camera: Fix Emscripten builds when using -sASYNCIFY.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Thanks to user pancakeswya on GitHub for the patch!

Fixes #13934.
2025-10-09 09:54:48 -04:00
Ryan C. Gordon 9a7cd95ac3 properties: Added SDL_PROP_NAME_STRING.
Fixes #14155.
2025-10-08 21:50:18 -04:00
Ryan C. Gordon 808a3f573f egl: Better attempt at retrying surface creation w/o EGL_EXT_present_opaque.
Fixes #13094.
2025-10-08 21:42:56 -04:00
Ryan C. Gordon 0467c531fa wasapi: Check for a NULL device during disconnect handling.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is probably something we already cleaned up that has something running
in an unexpected order now that we've moved disconnect work to the main thread.
2025-10-03 09:36:31 -04:00
Ryan C. Gordon 24b47814f8 emscripten: Another attempt at optionally having the canvas use whole window.
Fixes #11949.
2025-10-02 13:01:35 -04:00
Ryan C. Gordon a1672f2d2f docs: Fix param call on SDL_SetEventFilter.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
https://wiki.libsdl.org/SDL3/README-documentation-rules#dont-repeat-type-names-in-param-and-returns-sections
2025-09-27 13:55:31 -04:00
Ryan C. Gordon 2676f23910 audio: fix crash in SDL_GetAudioStreamOutputChannelMap.
Fixes #14058.
2025-09-27 13:31:29 -04:00
Ryan C. Gordon e528d5bd9f wasapi: Don't proxy device disconnect to the WASAPI management thread.
It gets proxied to the main thread, now.

Fixes deadlocks when unplugging a playing USB audio device.
2025-09-26 14:11:08 -04:00
Ryan C. Gordon 65e462a6f2 audio: Handle device disconnects on the main thread.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This avoids situations like:

- PulseAudio holds its own lock in the hotplug thread.
- The hotplug thread notices a device went away.
- The hotplug thread calls SDL_AudioDeviceDisconnected().
- SDL_AudioDeviceDisconnected() tries to grab the device lock.
- The device thread is holding the device lock...
- ...but is currently waiting on PulseAudio's lock to release.

In short: deadlock. It's better to queue this work to run on the main thread,
where we can guarantee a start with _none_ of the audio subsystem locks held.
2025-09-25 16:02:19 -04:00
Ryan C. Gordon f71348f38b examples/misc/02-clipboard: Removed onmouseover-generating helper include. 2025-09-25 13:50:58 -04:00
Ryan C. Gordon 2f30f7a6bd examples/misc/02-clipboard: Patched to compile on Visual Studio. 2025-09-24 17:14:53 -04:00
Ryan C. Gordon 17d77f5fbd examples: Added misc/02-clipboard 2025-09-24 14:41:29 -04:00
Ryan C. Gordon f5d7004cbb main: Fixed crashes if specifying hints to Emscripten as URL options. 2025-09-22 11:57:42 -04:00
Ryan C. Gordon 09ee8876b3 wav: Patched to compile on Visual Studio. 2025-09-22 10:37:52 -04:00
Ryan C. Gordon c8eb9f3706 x11: Set EGL surface for foreign X11 windows.
Cherry-picked by hand from SDL2: 780ec8fac0

Also cleaned up the XDestroyIC cleanup code to match the setup code.

Fixes #11996.
2025-09-22 10:37:52 -04:00
Ryan C. Gordon 44e4deab7c wav: Clamp DATA chunk to size of file if possible.
Prevents a malicious file from malloc'ing multiple gigabytes.

Fixes #10052.
2025-09-22 09:50:56 -04:00
Ryan C. Gordon 9ad04ff69e examples/misc/01-power/README.txt: fixed wording. 2025-09-16 14:37:51 -04:00
Ryan C. Gordon 1c9127ee4d examples: Preload onmouseover images, so it's more responsive to the user. 2025-09-16 14:22:39 -04:00
Ryan C. Gordon efb5829124 examples/misc/01-power/README.txt: Note that this is Chrome-only for now. 2025-09-16 13:37:58 -04:00
Ryan C. Gordon 3ee29f2e7a render: Don't default to vsync=0 on Emscripten.
Fixes #12805.
2025-09-16 12:30:22 -04:00
Ryan C. Gordon 9dbf2c7c0f examples/misc/01-power: Forgot to remove my code for building onmouseover. 2025-09-16 12:21:48 -04:00
Ryan C. Gordon f704661d22 examples: Added "misc" category for the web builds. 2025-09-16 12:08:04 -04:00
Ryan C. Gordon e341cc44cc examples: Added misc/01-power 2025-09-16 12:06:12 -04:00
Ryan C. Gordon 85ea2bfbf0 examples: Much, much easier way to generate thumbnail and onmouseover files. 2025-09-16 12:06:12 -04:00
Ryan C. Gordon de1b52f161 cmake: Adjust Enabled Backends list for render drivers to catch opengles2.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This happens to work here because we don't have anything too complex, afaik.
Rejecting strings with underscores was crucial for other things, like video
with all its X11 variables, so this can't be applied to the other subsystems.

(Also, renaming the `SDL_VIDEO_RENDER_OGL_ES2` variable might be nice, too,
but let's keep this simple for now.)

Fixes #13938.
2025-09-13 11:28:57 -04:00
Ryan C. Gordon 2ede37f5a3 cmake: Removed unused SDL_GPU_DXVK bits.
Reference Issue #13938.
2025-09-13 11:24:55 -04:00
Ryan C. Gordon 98e22213da emscripten: Do a little better at tracking Caps/Num/Scroll Lock state.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes #5447.
2025-09-13 01:50:22 -04:00
Ryan C. Gordon 411e47ba00 docs: Remove a redundant comment.
(The wiki will link to this symbol, we don't have to explicitly mention it.)
2025-09-12 20:11:44 -04:00
Ryan C. GordonandAnonymous Maarten 1c784c453d cmake: Report enabled subsystem backends in a compact form. (#13926)
Looks like this:

```
-- Enabled backends:
--   Video drivers: dummy kmsdrm(dynamic) offscreen wayland(dynamic) x11(dynamic)
--   X11 libraries: xcursor xdbe xfixes xinput2 xrandr xscrnsaver xshape xsync xtest
--   Render drivers: gpu ogl vulkan
--   GPU drivers: vulkan
--   Audio drivers: alsa(dynamic) disk dummy jack(dynamic) pipewire(dynamic) pulseaudio(dynamic) sndio(dynamic)
--   Joystick drivers: hidapi linux virtual
```

Fixes #7922.

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2025-09-12 14:59:43 -04:00
Ryan C. Gordon c78818bd4b examples: When linking to directories, append a '/' to the URL.
This works without it, but generates an extra redirect on the web server to
the same a URL with the '/' appended, so we might as well supply it ourselves
and remove the extra roundtrip to the server.
2025-09-12 14:23:01 -04:00
Ryan C. Gordon 614ae1b115 emscripten: Support analog gamepad triggers on both Firefox and Chrome.
Fixes #13051.
2025-09-12 14:23:01 -04:00
Ryan C. Gordon 8d5b82be2e io: POSIX implementation tries to get status information on short reads/writes.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes #13413.
2025-09-11 10:11:51 -04:00
Ryan C. Gordon 4d6e0e0087 io: read_fd should only report EOF on a zero-byte return value.
POSIX says that's the EOF indicator, not a non-zero a short read.
2025-09-11 10:11:50 -04:00
Ryan C. Gordon 387a2b924d Revert "Sync SDL3 wiki -> header"
This reverts commit 15e60cd37f.

We don't need to link to SDL_ttf here, it makes the headers look ugly.
2025-09-09 10:37:36 -04:00
Ryan C. Gordon 11411bb5ef renderer: Don't use wrapping on NPOT textures if the renderer can't handle it.
Fixes #13887.
2025-09-08 17:09:41 -04:00
Ryan C. Gordon a7ee54f9a3 examples/README: Added a note about generating onmouseevent and thumbnails.
So I don't have to figure this out every time I write a new example.
2025-09-07 17:45:38 -04:00
Ryan C. Gordon 7c6ecb1cc4 examples: Reencoded input/02-joystick-events/onmouseover.webp, much smaller. 2025-09-07 17:37:26 -04:00
Ryan C. Gordon a5d790124c examples: Added input/04-gamepad-events 2025-09-07 14:06:58 -04:00
Ryan C. Gordon cfa31df2d5 examples/input/03-gamepad-polling: Added some README notes about the web. 2025-09-07 11:48:53 -04:00
Ryan C. Gordon bab4bb3817 examples: Fixed HTML output with multi-paragraph READMEs. 2025-09-07 11:48:53 -04:00
Ryan C. Gordon 2a0e751ff5 gamepad: Fixed Emscripten guide button, after recent changes.
(buttons above 12 all shifted down by four, since the dpad buttons now look
like a hat...the only one above the dpad buttons on a standard layout is the
guide button, index 16. This change moves it to 12.)
2025-09-07 10:25:12 -04:00