Commit Graph

12826 Commits

Author SHA1 Message Date
Sam Lantinga
5f086e7623 Updated copyright for 2026 2026-01-01 09:40:08 -08:00
Anonymous Maarten
fc4f45f0e3 Updated to version 3.5.0 for development 2026-01-01 17:30:41 +01:00
Sam Lantinga
d15ecb21be Updated to version 3.4.1 for development 2025-12-31 18:18:45 -08:00
Sam Lantinga
a962f40bbb Updated to version 3.4.0 for release 2025-12-31 16:43:54 -08:00
Frank Praznik
cac2460623 x11: Don't dedup move/size events
The event core will do so automatically, and this may end up dropping events in rare cases when exiting fullscreen if an event with the final bordered window size is sent before the event notifying that the borders have come back on.
2025-12-31 17:55:32 -05:00
Ryan C. Gordon
25e33948af emscripten: Handle mouse button events more correctly.
Don't decide if the button is pressed by the `buttons` bitmask, but rather by
event type. On macOS, the trackpad might produce a mousedown event with taps
instead of full clicks--if tapping is enabled in System Preferences--and in
this case might not set the flag in the bitmask.

Fixes #14640.
2025-12-31 17:23:42 -05:00
Sam Lantinga
9698e20399 gpu renderer: fixed memory leak when resizing the backbuffer
Fixes https://github.com/libsdl-org/SDL/issues/14734
2025-12-31 08:00:26 -08:00
Sam Lantinga
0ac6f972f9 Added enhanced support for the Flydigi Vader 5 Pro controller 2025-12-31 07:46:56 -08:00
Frank Praznik
cb4f33b644 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.
2025-12-30 22:18:19 -05:00
Ryan C. Gordon
4d8f84f161 timer: Use the emscripten-specific code on Emscripten, even with threading.
Fixes #14640.
2025-12-30 18:57:55 -05:00
dwillbarron
618eb57519 DirectInput FFB: Calculate appropriate update flags (#14570)
Anecdotally, some force-feedback wheels have been reported to experience a
reduced "definition", "texture", "precision", or "je ne sais quoi", which
appears to be caused by sending more update flags than necessary to
DirectInput.

This may be related to the fact that there are two USB PID packets that are
sent when updating a device: One contains the "general" force data, and the
other contains the "type-specific" data. My speculation is that many wheels
expect to only receive the latter, and misbehave when receiving both.

This has been tested and validated anecdotally by others who have received
a hacked-together version of PCSX2 that corrects the flags sent to DirectInput,
who noted a significant improvement in the "feeling" of the FFB effects.

The only way to validate this at a technical level is to grab a wheel that uses
the "generic" DirectInput FFB drivers (which map nearly 1:1 with the USB PID
specification), and inspect the USB packets (e.g. with USBPcap) to check whether
redundant data is being sent.
2025-12-30 14:43:49 -08:00
Sam Lantinga
128b9260ec Added SDL_HINT_HIDAPI_LIBUSB_GAMECUBE
Fixes https://github.com/libsdl-org/SDL/issues/14682
2025-12-30 14:14:51 -08:00
Ryan C. Gordon
1a27b5b838 emscripten: set window->w and ->h when creating with external css sizing.
Fixes #14711.
2025-12-30 16:56:45 -05:00
Ryan C. Gordon
7d66d3271b emscriptenaudio: Don't force reset SDL3.audio_recording/audio_playback.
Otherwise, opening devices for recording and playback at the same time will
cause problems.
2025-12-30 15:40:25 -05:00
Ryan C. Gordon
b681862f14 emscripten: Don't pass an argument to MAIN_THREAD_EM_ASM_INT we don't use.
This upsets things, because you end up calling a javascript function with
more arguments than it expects, and if asserts are enabled, Emscripten notices
this and aborts the program when you hit this code.

Reference Issue #14670.
2025-12-30 15:40:25 -05:00
Eddy Jansson
3d354eeaad Prefer SDL_arraysize()
Replace uses of (sizeof(arr)/sizeof(arr[0]), and similar,
with the SDL_arraysize() macro.
2025-12-30 12:22:03 -08:00
Sam Lantinga
d33642b710 Filter libusb devices early in enumeration
Some device drivers crash if you query things like manufacturer and product name, so make sure we only touch devices that we're really interested in.
2025-12-30 10:52:56 -08:00
Frank Praznik
95ac0ff4d6 wayland: Center non-square icon images
Center icon images instead of scaling to preserve the aspect ratio.
2025-12-29 13:35:18 -05:00
MAJigsaw77
cb04dcd6f8 android: Add RGB LED support for joysticks. 2025-12-29 10:32:02 -08:00
Frank Praznik
4fcb92e0df wayland: Scale non-square icon images
Wayland icons must be square, so scale non-square images to fit a square region instead of failing. This matches X11 behavior.

A warning that the image will be scaled will be logged.
2025-12-29 12:56:42 -05:00
Sam Lantinga
d10fe8bf2f Added a Linux mapping for the Nacon GC100 controller (thanks @elkabyliano!) 2025-12-29 09:43:47 -08:00
Sam Lantinga
38345adff0 Don't set the active texture when creating a palette
Fixes https://github.com/libsdl-org/SDL/issues/14705
2025-12-29 09:36:13 -08:00
Simon McVittie
370e9407b5 wayland: If GTK is disabled, try to avoid libdecor's GTK plugin
As 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>
2025-12-28 10:19:33 -08:00
Simon McVittie
b6f4e10bf9 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>
2025-12-28 10:19:33 -08:00
Simon McVittie
9e0b31b297 unix: Factor out the check for GTK into an internal function
This will allow the same check to be done by the libdecor integration.

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-28 10:19:33 -08:00
Frank Praznik
1fee2a9ae0 wayland: Remove redundant mouse button releases
Any pressed buttons are released in the loop when the pointer leaves a surface, so no need to release them again.
2025-12-28 12:42:09 -05:00
Sam Lantinga
9fe5c1512f Added support for extended buttons on Wayland
Fixes https://github.com/libsdl-org/SDL/issues/14681
2025-12-27 14:50:43 -08:00
anonymix007
89dd2426cf Add SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER 2025-12-27 10:23:12 -08:00
Frank Praznik
8c54961de0 wayland: Send mouse coordinates after warping
Currently, no compositor that supports the warp protocol sends a motion event after doing so, so SDL must synthesize one when using the warp protocol, as it did with the locking protocol.

This can be avoided once
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/340 is completed.
2025-12-26 17:22:42 -05:00
Anonymous Maarten
9dd3e2305e dlnote: embed trailing semicolon in SDL_ELF_NOTE_DLOPEN macro 2025-12-24 23:45:50 +03:00
Nintorch
5c03796ac7 Fix Emscripten joysticks having the same name 2025-12-24 07:19:10 -08:00
Nintorch
0f1a705fda Fix Emscripten joystick rumble being swapped 2025-12-24 07:18:07 -08:00
Edgar San Martin, Jr.
bd29d60d3c GPU: Add bounds validation for slot bindings and uniform data pushes. (#14692) 2025-12-23 08:36:06 -08:00
Sam Lantinga
0b9946d7bf Fixed crash when using the NVIDIA Shield controller 2025-12-22 11:29:47 -08:00
Frank Praznik
9094395b13 wayland: Use the implicit grab serial when clearing the clipboard
Some compositors won't clear the selection without a valid serial.
2025-12-22 13:29:28 -05:00
999pingGG
5a257202d2 GPU: Better detection of surface destruction 2025-12-21 17:16:34 -08:00
Sam Lantinga
efc33633e3 Allow the offscreen and dummy drivers to be used as fallback 2025-12-21 16:18:07 -08:00
Frank Praznik
37fca1fdcf 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.
2025-12-21 12:44:19 -05:00
Kaleb Reid
341f60555f Fix building joystick for OpenBSD 2025-12-21 07:58:41 -08:00
Sam Lantinga
0d705ca275 Use the aggregate upower device for power status when available 2025-12-19 17:42:33 -08:00
999pingGG
190b902fac GPU: Fix Android surface and swapchain recreation on app resume (#14676) 2025-12-19 09:54:08 -08:00
Ryan C. Gordon
2c3657a0ce egl: Patched to compile.
Yeehaw, cowboy committer!  🤦
2025-12-17 17:27:51 -05:00
Ryan C. Gordon
46df9ea92a egl: Call SDL_EGL_SetSwapInterval during context creation, not the GL version.
The `GL` version returns early because the context isn't set yet, whereas the
`EGL` version works out here.

Fixes #14642.
2025-12-17 17:16:39 -05:00
Frank Praznik
235f417616 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.
2025-12-17 15:12:27 -05:00
Sam Lantinga
63636c8403 Fixed warning: implicit conversion loses integer precision 2025-12-16 14:51:19 -08:00
Sam Lantinga
c7508ca2e9 Fixed warning: no previous prototype for function 'ParseDescriptor' 2025-12-16 14:51:19 -08:00
Sam Lantinga
d583fc88be Updated to version 3.3.7 for development 2025-12-16 09:38:05 -08:00
Sam Lantinga
ef0a604d44 Updated to version 3.3.6 for preview release 2025-12-16 08:54:04 -08:00
Sam Lantinga
aeb4b3d2fc Reverted Vita cliprect changes
Temporarily backing out cliprect changes which caused logical presentation regressions.

Fixes https://github.com/libsdl-org/SDL/issues/14645
Reopens https://github.com/libsdl-org/SDL/issues/13034
2025-12-16 08:47:45 -08:00
Frank Praznik
78d008fcd2 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.
2025-12-16 11:45:36 -05:00