Commit Graph

22543 Commits

Author SHA1 Message Date
Frank Praznik
184a070c5f Remove uses of stpcpy()
This function was only standardized in POSIX.1-2008, is not part of any ISO C standard, and is generally considered unsafe. Use SDL_strlcpy() instead.
2026-09-08 14:29:55 -04:00
Frank Praznik
f48fa604b0 x11: Clear the internal selection data when updating the clipboard
Clear the internal X11 clipboard selection data when updating the clipboard during SelectionNotify events, as it is invalid after the update. Otherwise, an out-of-date SelectionRequest can end up attempting to read the invalid data, and cause a crash.
2026-09-08 13:17:01 -04:00
Frank Praznik
84cd92d705 wayland: Avoid dereferencing a nil data offer
Pass the data device to the selection offer update functions instead of pulling it from the offer, as the offer may be nil.
2026-09-08 11:25:52 -04:00
Frank Praznik
25f4af8fcf x11: Handle XTranslateCoordinates failing during a reparenting operation
XTranslateCoordinates can generate a BadWindow error if called during a racy reparenting operation, so a non-fatal error handler is required.
2026-09-08 10:48:37 -04:00
Ethan Lee
6083940ef4 Add support for the Xbox 360 "Big Button" wireless receiver 2026-09-07 17:30:01 -04:00
muzikbike
42ad5c9955 Split System Request from Print Screen in XF86 as well 2026-09-06 09:43:02 -07:00
Frank Praznik
7e8a850246 x11: Register IM destruction/instantiation callbacks
Register callbacks to listen for IM destruction and instantiation to handle the IME shutting down and restarting during runtime.
2026-09-06 11:52:28 -04:00
Anonymous Maarten
c1ef7793c7 cmake: detect lld-link cli argument errors 2026-09-04 22:55:31 +02:00
Ryan C. Gordon
ea74d3b018 metal: Clear bogus pointer if we fail to get a new drawable.
Reference Issue #16232.
2026-09-04 15:55:40 -04:00
Sylvain
f034d594a8 Fix android build with SDK 37.2: Allow dots in platform directory names and use CMake version comparison 2026-09-04 20:00:49 +02:00
SDL Wiki Bot
d4410b9a7c Sync SDL3 wiki -> header
[ci skip]
2026-09-03 15:57:27 +00:00
muzikbike
dfcc6dee02 Change XF86 scancodes2 to match Linux
Should fix #16164
2026-09-03 07:19:33 -07:00
William Horvath
f443c429c6 d3d12: Read the fence in SubmitAndAcquireFence while submitLock is held
Once the lock is released, another thread can clean up the completed
command buffer, return it to the pool and resubmit it with a different
fence before we read d3d12CommandBuffer->inFlightFence, handing the
caller a fence it doesn't own (or NULL).
2026-09-02 13:03:04 -07:00
William Horvath
d8451e52d5 metal: Make the command buffer hold a reference to its fence
METAL_ReleaseFence cleared the fence's MTLCommandBuffer without holding
submitLock, while METAL_Submit's cleanup loop may still be polling it
through submittedCommandBuffers. It also did so before the DecRef, so
any non-final release broke later waits on a still-owned fence.
2026-09-02 13:03:04 -07:00
William Horvath
10309e3240 metal: Read the fence in SubmitAndAcquireFence while submitLock is held
Once the lock is released, another thread can clean up the completed
command buffer, return it to the pool and resubmit it with a different
fence before we read metalCommandBuffer->fence, handing the caller a
fence it doesn't own.
2026-09-02 13:03:04 -07:00
Sawkez
9dcc2e48fa implement joystick hotplugging 2026-09-02 11:52:16 -07:00
Frank Praznik
ec6790bd5e x11: Ignore BadWindow errors when handling a SelectionRequest
When handing a SelectionRequest event, XChangeProperty can generate a BadWindow error if the requesting window was already destroyed. Register an error handler to catch this, and prevent it from being fatal.
2026-09-02 12:35:41 -04:00
Ryan C. Gordon
a29eba40a4 kmsdrm: atomic path FIXME cleanup, must call CreateSurfaces.
This was a pending question from the atomic merge. Not only does this function
need to be called, it needs to be called in the SwapWindow* functions first,
like the legacy (non-atomic) path does.

Reference Issue #16136.
2026-09-02 10:35:37 -04:00
Evan Hemsley
b54c7178b9 GPU D3D12: Fix depth format sample count support check 2026-09-02 09:23:42 -04:00
Sam Lantinga
c8d08ea2df Use the surface palette when creating a texture from a surface
Fixes https://github.com/libsdl-org/SDL/issues/16227
2026-09-01 16:38:16 -07:00
Sam Lantinga
757400e044 Main callbacks should be processed even if events are already pending in SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/15485
2026-09-01 15:36:38 -07:00
Cameron Cawley
79a4ea1c54 Improve implementation of GetClosestSupportedFormat (#15577)
* Indexed textures are now used for <8bpp surfaces and for indexed surfaces with transparency.
* If the software renderer is using RGB565 or BGR565, it now successfully detects a suitable 32-bit alpha format for converting the colour key.
* Matching pixel layouts are prioritized rather than just the number of bytes per pixel.
2026-09-01 15:14:44 -07:00
Brenton Bostick
46a942a3e3 fix typo 2026-09-01 11:23:57 -07:00
Ryan C. Gordon
22e42e6e1e aaudio: Make input preset into a hint, don't set it by default.
Fixes #16130.
Reference Issue #13402.
2026-09-01 14:03:24 -04:00
Ethan Lee
c5f07f0990 gpu: Return early when attempting to bind 0 samplers.
This is a common occurrence for vertex shaders specifically, and allows backends
to not have to handle this edge case every time.
2026-09-01 08:25:20 -04:00
SDL Wiki Bot
9e6f0180a0 Sync SDL3 wiki -> header
[ci skip]
2026-08-31 17:34:01 +00:00
Ryan C. Gordon
fd28dc9d56 PULL_REQUEST_TEMPLATE.md: "Zlib" should not be capitalized. 2026-08-31 13:27:23 -04:00
Ryan C. Gordon
83ab835bfd AGENTS.md: Updated text with latest policy revisions.
Reference Issue #15350.
2026-08-31 13:27:23 -04:00
Frank Praznik
2ec0b24b54 x11: Only position the fullscreen window if not on the target display
Entering fullscreen and moving the window can be a racy operation on some desktops, and isn't needed when the window is already on the target display, so only do it when necessary.
2026-08-31 13:08:42 -04:00
Sam Lantinga
70e9cc86dd Don't use the HIDAPI driver for the Tarantula 8K controller with stock firmware
This controller needs a firmware update before we can interpret its reports.
2026-08-31 09:35:51 -07:00
Frank Praznik
013844b003 cocoa: Convert popup window coordinates to global when adjusting the pointer offset
Fixes a regression in 958c4cbf0d
2026-08-31 11:58:59 -04:00
Anonymous Maarten
46498bc247 ci: run controller on ubuntu-slim 2026-08-29 19:18:57 +02:00
Ryan C. Gordon
c71abd0860 bmp: Correctly load RLE-encoded bitmaps with irregular widths.
(Such as a 4-bpp image--two pixels per byte--with an odd number of pixels.)

Fixes #16210.
2026-08-28 21:23:59 -04:00
Frank Praznik
6b18df27f7 events: Add pinch event category
Needed to allow SDL_GetWindowFromEvent() to work with pinch events.
2026-08-28 11:32:28 -04:00
Sawkez
338768e23d PS2: fix textures rendering at half opacity when blend is enabled 2026-08-27 15:57:59 -07:00
Sam Lantinga
8d6c456fb3 Fixed reading the factory stick calibration for Nintendo Switch controllers 2026-08-27 11:43:21 -07:00
Ryan C. Gordon
af9dbb65f6 alsa: Manage device index, not just card ID.
Otherwise multiple devices on one card won't open correctly.

Fixes #16205.
2026-08-27 14:23:09 -04:00
Ryan C. Gordon
774a3a0ab1 joystick: Fixed \since version for new sensor APIs. 2026-08-27 11:06:05 -04:00
Ryan C. Gordon
4f3d7017b0 joystick: Expose sensor data at the SDL_Joystick level.
Previously this was only available through the gamepad API, but this state has
always actually lived on the lower-level joystick objects, so there's no sense
in not offering a public API for that level, as well.

Closes #16202.
2026-08-27 10:18:03 -04:00
Ryan C. Gordon
4f477c807c cocoa: Run the CFRunLoop for 20ms during SDL_Quit().
This lets the OS remove windows that were destroyed in cases where we aren't
terminating the process right after calling SDL_Quit(). Otherwise, they'll
stay on the screen, unresponsive.

Apparently there is some animation state that needs to complete, and that is
handled via the runloop.

Fixes #10081.
2026-08-27 00:23:20 -04:00
Ryan C. Gordon
618890f8fa emscripten: Don't fall back to simulating vsync if settings are still pending.
Fixes #16146.
Closes #16151.
2026-08-27 00:19:56 -04:00
Anonymous Maarten
368b6cedf6 cmake: fix indentation in CheckPipewire 2026-08-27 00:24:13 +02:00
Anonymous Maarten
3eb19e5fec ci: bump ninja version 2026-08-27 00:24:01 +02:00
Crispin
1f922d7c06 Add more 'see also's to header comments in SDL_gpu.h 2026-08-26 09:13:24 -07:00
Frank Praznik
bc0a43ec7f wayland: Don't perform hit testing during implicit pointer grabs
Skip hit testing when an implicit grab is active, or button raise events may be lost, and the cursor icon may be improperly set if the client reports hit test results while the pointer is outside the window bounds.
2026-08-26 12:05:15 -04:00
sxvlsl
6a3062fd6c joystick: Add VKB Gladiator NXT Evo to the flight stick device list 2026-08-26 07:44:01 -07:00
Vlad Zahorodnii
5e8eb0d4e7 x11: Skip announcing WM_TAKE_FOCUS in WM_PROTOCOLS
By putting the WM_TAKE_FOCUS atom in the WM_PROTOCOLS property, SDL
chooses either the "Locally Active" or "Globally Active" input model
depending on the input flag in WM_HINTS.

In order to assist the window manager with making the right decision,
for example, skip this window when choosing what window to activate
next, it will be better if the WM knows right away that the window
accepts or doesn't accept focus (in other words, have either both
the input flag set in WM_HINTS + WM_TAKE_FOCUS or none).

Since the WM_TAKE_FOCUS atom is placed in the WM_PROTOCOLS property, the
WM wanting to adhere to the spec has no choice but send a client message
asking to activate the window and hope for the better.

At quick glance, it appears that the WM_TAKE_FOCUS atom is leftover from
SDL_WINDOWEVENT_TAKE_FOCUS, which was dropped a while ago, and is not
used anymore. So this change removes the WM_TAKE_FOCUS atom to help
window managers such as kwin work better.
2026-08-25 12:41:30 -04:00
Sam Lantinga
452c3634d4 Fixed two cases where joystick/haptic objects should be marked invalid on error during open. 2026-08-24 16:31:46 -07:00
muzikbike
40e1357e29 Add Wake Up key code for Windows
deduced experimentally via experimentation with consumer hardware
2026-08-24 15:36:53 -07:00
Sam Lantinga
6648b7966c Added a Windows mapping for the Gamesir-G5
Fixes https://github.com/libsdl-org/SDL/issues/16190
2026-08-24 13:14:22 -07:00