Commit Graph

19631 Commits

Author SHA1 Message Date
Frank Praznik
6034cf5cd8 gpu: Use the window event watcher list for Vulkan and D3D12
Events won't be delivered to the regular event watcher list callbacks if a client event filter discards events. Use the special window event watcher list to watch for resizes in the GPU renderers, as events are delivered to this list before a client can potentially discard them.

(cherry picked from commit cb4f33b644)
2025-12-31 07:52:03 -08:00
Ryan C. Gordon
cfc41248be timer: Use the emscripten-specific code on Emscripten, even with threading.
Fixes #14640.

(cherry picked from commit 4d8f84f161)
2025-12-31 07:52:03 -08:00
Simon McVittie
d1d0a50751 wayland: If GTK is disabled, try to avoid libdecor's GTK plugin
As described in the previous commit, loading GTK while setuid or setgid
would result in the process exiting. This is equally true if it's loaded
indirectly, for a libdecor plugin.

libdecor doesn't currently have any API by which it can be asked to
avoid specific plugins, but its GTK plugin declines to initialize if it
detects a non-main thread (because GTK documents that it must only be
used from the main thread), resulting in libdecor falling back to the
lower-priority Cairo plugin. We can make use of this by intentionally
initializing libdecor on another thread if we have been asked to avoid
GTK. This is a bit of a hack, but at worst it should be harmless.

Resolves: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit 370e9407b5)
2025-12-30 17:13:51 -08:00
Simon McVittie
aeca6a77cf unix: If setuid or setgid, don't use GTK
GTK explicitly doesn't support being used setuid or setgid, and if SDL
loads and initializes GTK, GTK will exit the process if it
detects a setgid executable. This is incompatible with the historical
practice of making game executables setgid in order to write out a
shared high-score table on multi-user systems (which is security theatre
at best, because typical game runtime libraries are not hardened against
an untrusted caller, but making it regress would be a user-observable
regression in sdl2-compat).

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit b6f4e10bf9)
2025-12-30 17:13:51 -08:00
Simon McVittie
a45a2368a7 unix: Add internal function SDL_CanUseGtk()
Necessary for a backport of #14712 to the 3.2.x branch. In the 3.4.x
branch this was factored out from tray-icon code, but 3.2.x doesn't have
that functionality.

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-30 17:13:51 -08:00
Simon McVittie
888104f5ad Document SDL's policy on setuid/setgid executables
Stated briefly, the policy is: don't.

Resolves: https://github.com/libsdl-org/SDL/issues/14717
Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit 76352f2931)
2025-12-28 10:16:44 -08:00
Ozkan Sezer
ec1d66d4f6 Revert "GPU: Add bounds validation for slot bindings and uniform data pushes. (#14692)"
This reverts commit 4b0a1df21f.
(Was cherry picked from commit bd29d60d3c)
2025-12-25 02:10:02 +03:00
Edgar San Martin, Jr.
4b0a1df21f GPU: Add bounds validation for slot bindings and uniform data pushes. (#14692)
(cherry picked from commit bd29d60d3c)
2025-12-23 08:36:56 -08:00
Frank Praznik
bfe3abdc26 wayland: Use the implicit grab serial when clearing the clipboard
Some compositors won't clear the selection without a valid serial.

(cherry picked from commit 9094395b13)
2025-12-22 13:32:13 -05:00
Sam Lantinga
9b1843c8da Allow the offscreen and dummy drivers to be used as fallback
(cherry picked from commit efc33633e3)
2025-12-21 16:18:21 -08:00
Frank Praznik
12d8540800 video: Unload GL/Vulkan when shutting down the video subsystem
If GL/Vulkan was loaded manually via a SDL_X_LoadLibrary() call instead of via window flags or through the GPU or renderer system, and there is no matching SDL_X_UnloadLibrary() call, the library instance won't be automatically unloaded while shutting down the video system, as the refcount won't go to zero, which can cause problems with some backends, and leaves a leaked DLL/SO handle when the global video object is destroyed.

Ensure that the libraries are unloaded after destroying the windows, but before shutting down the video backend, to prevent a leak and possible driver errors when shutting down the video backend.

(cherry picked from commit 37fca1fdcf)
2025-12-21 12:45:10 -05:00
Kaleb Reid
15f1a26656 Fix building joystick for OpenBSD
(cherry picked from commit 341f60555f)
2025-12-21 07:59:13 -08:00
Ryan C. Gordon
cb81c21f62 egl: Better attempt at retrying surface creation w/o EGL_EXT_present_opaque.
Fixes #13094.

(cherry picked from commit 808a3f573f)
2025-12-20 12:11:54 -06:00
eafton
c3cb21a498 Fix for #13094
(cherry picked from commit 98eaa05a9f)
2025-12-20 12:11:54 -06:00
Frank Praznik
cd4aa78d9a wayland: Update the HDR data on placeholder displays
Update the HDR data on a placeholder display if it hasn't been finalized and added yet, or the HDR data on the added display will be incorrect.

(cherry picked from commit 235f417616)
2025-12-17 15:13:52 -05:00
Frank Praznik
1f216da1e6 x11: Don't poll the map state when the window was unmapped and borders are toggled
An event flush while a window is being hidden may try to toggle the window borders. Don't poll the mapping state when toggling borders if the window is in the process of being hidden, or the window may already be unmapped, and the wait loop will hang forever.

(cherry picked from commit 78d008fcd2)
2025-12-16 11:46:47 -05:00
Edgar J San Martin
99cbedd662 Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.
(cherry picked from commit 09a2283b53)
2025-12-15 17:01:56 -08:00
Jakub Wasilewski
e8fbb7e820 GPU: Metal: Rebind storage buffers when changing the pipeline moves them.
(cherry picked from commit 73c9f25867)
2025-12-15 11:45:58 -08:00
Sam Lantinga
7f84afa68b Pass the window along with evdev touch events
Fixes https://github.com/libsdl-org/SDL/issues/14644

(cherry picked from commit 518c98ea01)
2025-12-15 08:29:45 -08:00
Fredrik Foss-Indrehus
51786880f4 cmake: add reftable ref storage support to GetGitRevisionDescription
The script assumed Git's traditional loose refs or packed-refs format.
When cloning with extensions.refstorage=reftable, neither .git/refs/*
nor .git/packed-refs exist, causing cmake configuration to fail.

Fall back to git rev-parse when file-based ref lookup fails.

(cherry picked from commit bdb72bb3f0)
2025-12-11 16:14:34 -08:00
Arnoldo Adonaí Barón Robles
e0050c3a9f GPU: Fix crash on Android upon returning from the background
(cherry picked from commit e5731f9bac)
2025-12-10 18:10:08 -08:00
Ozkan Sezer
0ca7052345 stb_image.h: apply patches from mainstream PRs 1839, 1862 and 1863.
Patches authored by @NBickford-NV to fix mainstream issues 1838, 1860,
1861.

(cherry picked from commit 9c6c2387b9)
(cherry picked from commit c7133a6720)
2025-12-10 21:05:20 +03:00
Ryan C. Gordon
bcdb3eddcc WhatsNew.txt: Moved some missing entries over to the release-3.2.x branch.
Fixes #14622.
2025-12-08 11:08:04 -05:00
Qiu Qiang
057634d069 Fix loop variable bug in V4L2 camera format enumeration
(cherry picked from commit 19988c5faa)
2025-12-07 14:12:03 -08:00
LuncyBloont
eb5eb4a33d Fix crash in UploadToTexture() on DX12.
(cherry picked from commit ab67be7e5a)
2025-12-05 11:47:02 -08:00
Eddy Jansson
df145a9649 log: Fix unlikely out-of-bounds issue.
In the unlikely case that the overflow check should fail,
the else clause would switch to the truncated stack message
without updating the len variable. This would contain the
return value from vsnprintf(), meaning it could point beyond
the buffer.

The subsequent code which trims NL and CR from the buffer,
would then read -- and possibly write -- out-of-bounds.

To fix this, we split the two joint conditions into separate
if-clauses, and adjust the len variable in the case where we
know the message buffer was truncated.

(cherry picked from commit 2cb9a4fcc1)
2025-12-04 13:20:34 -08:00
cosmonaut
b8618dd405 GPU: Remove erroneous buffer usage flag from defrag process
(cherry picked from commit aae2f74ae6)
2025-12-03 15:03:53 -08:00
Simon McVittie
ddb497e815 testver: Assert that SDL_GetRevision() starts with SDL-
https://github.com/libsdl-org/SDL/issues/14575

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 65ef4df6d4)
2025-12-03 08:51:53 -08:00
Simon McVittie
6a42180dbf build-scripts: Include SDL- prefix in SDL_REVISION when built from tarball
https://github.com/libsdl-org/SDL/issues/14575

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cc681ffeda)
2025-12-03 08:51:52 -08:00
Anonymous Maarten
223a3dc461 release: verify SDL_REVISION contains SDL-
(cherry picked from commit 3313cb9c4b)
2025-12-03 08:51:52 -08:00
Toast
13373ef501 Added Keychron V5 System Control to the controller blacklist
(cherry picked from commit 1dea7c801b)
2025-12-03 07:15:22 -08:00
Sam Lantinga
a7de0d9a3e Updated to version 3.2.29 for development 2025-12-02 13:02:25 -08:00
Sam Lantinga
7f3ae3d574 Updated to version 3.2.28 for release release-3.2.28 2025-12-02 07:47:05 -08:00
Cameron Gutman
80f82acdf8 quit: don't call signal() if we're using sigaction()
At best, this is a no-op.

At worst, it might:
 - Clobber a signal handler someone registered after us
 - Overwrite the signal mask or flags
 - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal())

(cherry picked from commit 6d99204a82)
2025-12-01 19:47:32 -06:00
Sam Lantinga
78146bb14c Correct the sensor axis ordering with the Linux Nintendo driver
Fixes https://github.com/libsdl-org/SDL/issues/14552

(cherry picked from commit 5e9163592f)
2025-11-30 11:37:34 -08:00
Amelia Clarke
c61f97dbce events: fix SDL_PeepEvents() returning 0 on error
Signed-off-by: Amelia Clarke <selene@perilune.dev>
(cherry picked from commit defd7895da)
2025-11-28 07:42:09 -08:00
Anonymous Maarten
c823f837c0 ci: bump macos-13 to macos-14
macos-13 image is getting retired in December 2025

(backported from commit 7a26bee6ee)
2025-11-26 17:25:50 +03:00
Anonymous Maarten
f8252fcc91 JNI_Unload must return the JNI version needed by the native library
(cherry picked from commit eda8d1d842)
2025-11-26 14:05:37 +01:00
Ryan C. Gordon
98ed8b98b1 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.

(cherry picked from commit 4e79d2ad64)
2025-11-25 14:41:57 -08:00
Ryan C. Gordon
5f5a73a8f6 blit: Check MSVC's _M_ARM64 define in addition to __aarch64__.
Reference Issue #14519.

(cherry picked from commit 7f0d0d0046)
2025-11-25 14:41:49 -08:00
Ryan C. Gordon
50be2a7e56 blit: Change ifdefs on NEON functions that use an aarch64-specific opcode.
Fixes #14519.

(cherry picked from commit 15f98b2a61)
2025-11-25 14:41:07 -08:00
Ethan Lee
4fdbac7207 video: Explicitly call DestroyWindowTexture when destroying a window.
This prevents some recursion issues with hashtables, as described in #14499.
2025-11-24 01:25:38 -05:00
Sam Lantinga
8199076878 vulkan gpu: set the sample count for depth prepass
Fixes https://github.com/libsdl-org/SDL/issues/14500

(cherry picked from commit 1fc093491a)
2025-11-22 07:54:21 -08:00
Susko3
c49de41ef3 Fix WM_SYSKEYDOWN not being trapped by IME message handling
This would cause Alt + <something> not being trapped if handled by the system IME.

(cherry picked from commit 2ef005afe5)
2025-11-19 13:40:19 -08:00
Sam Lantinga
ad5681c45b Fixed crash in the vulkan renderer when the window is minimized
There's more work to do here in other cases where we can't recreate the swap chain, but this fixes the common minimize case.

Fixes https://github.com/libsdl-org/SDL/issues/14434

(cherry picked from commit 0ae3d7b0b0)
2025-11-14 12:35:42 -08:00
Sam Lantinga
daf76f1ff6 Restored the original OpenBSD Xbox 360 controller mapping
(cherry picked from commit 90242312fe)
2025-11-14 07:20:17 -08:00
Sam Lantinga
cdff4b2bb5 Completed removing predefined Xbox 360 mappings for Linux
Also removed them for OpenBSD, since it's not clear which ones, if any, are needed.

(cherry picked from commit b305534edc)
2025-11-14 07:20:17 -08:00
Dave Wickham
d3a1a97db8 Re-add deleted gamepad mappings to the OpenBSD-specific section
(cherry picked from commit f6c3af9c8c)
2025-11-14 07:20:16 -08:00
Dave Wickham
962464629d Remove special-case Xbox 360 wireless controller mappings
Fixes https://github.com/libsdl-org/SDL/issues/14324

(cherry picked from commit 0c4c4cfd16)
2025-11-14 07:20:16 -08:00
Sam Lantinga
3291c2e560 Check for wine_get_version() to detect Wine/Proton
If this application is being run under Wine but Steam doesn't know that, Steam won't set STEAM_COMPAT_PROTON. So we'll use wine_get_version() to detect that we're running under Wine instead.

(cherry picked from commit e2e8f86076)
2025-11-12 22:30:48 -08:00