Commit Graph

21878 Commits

Author SHA1 Message Date
Evan Hemsley
42c75433d3 GPU: Allow multisample textures to be read (#15838)
(cherry picked from commit 1a2ba3b94d)
2026-09-14 12:13:43 -07:00
Frank Praznik
fd30f06df4 dbus: Use the minimum privileges when opening an fd for the OpenURI portal
Open files and directories as read-only, as the fd is only used as proof of access by the portal, and a mismatch between fd write permissions and the portal write parameter will cause the fd to be rejected.

(cherry picked from commit fb8cdf0aa8)
2026-09-14 12:48:21 -04:00
Frank Praznik
b673d2bef2 x11: Update all device info on XI_DeviceChanged
XI_DeviceChanged should trigger an update of both relative and scroll info on the device, as anything may have changed. Combine the scroll and relative valuators into one device info struct, and update them together.

(cherry picked from commit c72fbe7d89)
2026-09-12 10:52:27 -04:00
Frank Praznik
f6388b5f38 x11: Move the xinput2 device info to the xinput2 source file
It was declared in the mouse header, but is not actually needed there aside from cleanup, which can be moved to the xinput2 quit function.

(cherry picked from commit 4d9cd86775)
2026-09-12 10:52:27 -04:00
Ryan C. Gordon
6fd2c83640 kmsdrm: Instead of demanding ARGB8888, try to find a supported surface format.
Fixes #16136.

(cherry picked from commit 68655e9772)
2026-09-11 00:10:01 -04:00
Sam Lantinga
226e304034 Make sure the palette is no longer in use before freeing it in the Vulkan renderer
Fixes https://github.com/libsdl-org/SDL/issues/16283

(cherry picked from commit 04b2fb8046)
2026-09-10 13:31:37 -07:00
Sam Lantinga
04289da574 Fixed Vulkan validation error in SDL_RenderReadPixels()
Validation Error: [ VUID-VkImageMemoryBarrier-oldLayout-01212 ] | MessageID = 0xff795e16
  vkCmdPipelineBarrier(): pImageMemoryBarriers[0].newLayout (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) is not compatible with VkImage 0x2160000000216 usage flags VK_IMAGE_USAGE_2_TRANSFER_DST_BIT_KHR|VK_IMAGE_USAGE_2_COLOR_ATTACHMENT_BIT_KHR.
  The Vulkan spec states: If layouts are not ignored, oldLayout or newLayout is VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL then image must have been created with the VK_IMAGE_USAGE_TRANSFER_SRC_BIT usage flag set (https://docs.vulkan.org/spec/latest/chapters/synchronization.html#VUID-VkImageMemoryBarrier-oldLayout-01212)

(cherry picked from commit 3df2b1a2a7)
2026-09-10 13:31:27 -07:00
Frank Praznik
89fc9aa6bb x11: Rescan the relative valuators on XI_DeviceChanged
XI_DeviceChanged can have a reason of XISlaveSwitch, which indicates that the valuators need to be updated for the specified device.

(cherry picked from commit b88e540783)
2026-09-10 11:54:30 -04:00
Frank Praznik
97594f82cd x11: Don't suppress slave mouse buttons when lacking keyboard focus
The window may not have keyboard focus when using remote control tools, so drop the keyboard focus requirement. Tested not to regress clickthrough suppression.

(cherry picked from commit 9adf3ff6d3)
2026-09-09 13:41:07 -04:00
Anonymous Maarten
2f0733f716 pre-mingw-w64 MinGW toolchains don't ship with a intrin.h header
(cherry picked from commit f9abf9e843)
2026-09-09 03:20:00 +02:00
Frank Praznik
44fbe7173f wayland: Don't use a stale scaling factor
The output integer scale may not be re-sent if the display geometry changed, but the scale factor didn't. Cache and restore it on the integer path, to prevent an old value from being used, and possibly rounded to zero if the old value was less than 1.0.

(cherry picked from commit aa5bffa6d3)
2026-09-08 15:47:22 -04:00
Frank Praznik
1efd4a8ffc 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.

(cherry picked from commit f48fa604b0)
2026-09-08 13:17:32 -04:00
Frank Praznik
44a04139e3 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.

(cherry picked from commit 25f4af8fcf)
2026-09-08 10:49:02 -04:00
Frank Praznik
f53495997c 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.

(cherry picked from commit 7e8a850246)
2026-09-06 11:53:06 -04:00
Anonymous Maarten
a31d7f6a95 cmake: detect lld-link cli argument errors
(cherry picked from commit c1ef7793c7)
2026-09-04 22:57:07 +02:00
Ryan C. Gordon
9e7e1271fd metal: Clear bogus pointer if we fail to get a new drawable.
Reference Issue #16232.

(cherry picked from commit ea74d3b018)
2026-09-04 15:56:41 -04:00
William Horvath
9a29f763e1 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).

(cherry picked from commit f443c429c6)
2026-09-02 13:03:44 -07:00
William Horvath
51ef86a11f 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.

(cherry picked from commit d8451e52d5)
2026-09-02 13:03:44 -07:00
William Horvath
39664f3b77 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.

(cherry picked from commit 10309e3240)
2026-09-02 13:03:44 -07:00
Sawkez
295ca921c4 implement joystick hotplugging
(cherry picked from commit 9dcc2e48fa)
2026-09-02 11:52:56 -07:00
Frank Praznik
c64d28aa40 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.

(cherry picked from commit ec6790bd5e)
2026-09-02 12:36:48 -04:00
Sam Lantinga
cd09df3376 Updated to version 3.4.17 for development 2026-09-02 09:24:22 -07:00
Sam Lantinga
fa2c02bb6e Updated to version 3.4.16 for release release-3.4.16 2026-09-02 09:00:30 -07:00
Ryan C. Gordon
7c9bc31f70 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.

(cherry picked from commit a29eba40a4)
2026-09-02 10:40:00 -04:00
Evan Hemsley
489f8fc0a8 GPU D3D12: Fix depth format sample count support check 2026-09-02 09:24:10 -04:00
Sam Lantinga
f26af13381 Main callbacks should be processed even if events are already pending in SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/15485

(cherry picked from commit 757400e044)
2026-09-01 15:42:43 -07:00
Brenton Bostick
bee45bd114 fix typo
(cherry picked from commit 46a942a3e3)
2026-09-01 11:24:53 -07:00
Ryan C. Gordon
aba2d16233 aaudio: Make input preset into a hint, don't set it by default.
Fixes #16130.
Reference Issue #13402.

(cherry picked from commit 22e42e6e1e)
2026-09-01 14:03:41 -04:00
Ethan Lee
4aa40070ef 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:26:38 -04:00
Ryan C. Gordon
27d56a5e64 PULL_REQUEST_TEMPLATE.md: "Zlib" should not be capitalized.
(cherry picked from commit fd28dc9d56)
2026-08-31 13:27:58 -04:00
Ryan C. Gordon
197e5d0c23 AGENTS.md: Updated text with latest policy revisions.
Reference Issue #15350.

(cherry picked from commit 83ab835bfd)
2026-08-31 13:27:56 -04:00
Frank Praznik
5b492bd278 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.

(cherry picked from commit 2ec0b24b54)
2026-08-31 13:09:09 -04:00
Frank Praznik
4ef437dc55 cocoa: Convert popup window coordinates to global when adjusting the pointer offset
Fixes a regression in 958c4cbf0d

(cherry picked from commit 013844b003)
2026-08-31 11:59:27 -04:00
Ryan C. Gordon
58ff755ea5 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.

(cherry picked from commit c71abd0860)
2026-08-28 21:24:23 -04:00
Frank Praznik
8b2ecd481b events: Add pinch event category
Needed to allow SDL_GetWindowFromEvent() to work with pinch events.

(cherry picked from commit 6b18df27f7)
2026-08-28 11:34:18 -04:00
Sawkez
c589241ba1 PS2: fix textures rendering at half opacity when blend is enabled
(cherry picked from commit 338768e23d)
2026-08-27 15:58:15 -07:00
Sam Lantinga
2ca5446cd4 Fixed reading the factory stick calibration for Nintendo Switch controllers
(cherry picked from commit 8d6c456fb3)
2026-08-27 11:43:42 -07:00
Ryan C. Gordon
c446a31d1c alsa: Manage device index, not just card ID.
Otherwise multiple devices on one card won't open correctly.

Fixes #16205.

(cherry picked from commit af9dbb65f6)
2026-08-27 14:25:16 -04:00
Ryan C. Gordon
2954b9168d 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.

(cherry picked from commit 4f477c807c)
2026-08-27 00:25:31 -04:00
Ryan C. Gordon
2776931725 emscripten: Don't fall back to simulating vsync if settings are still pending.
Fixes #16146.
Closes #16151.

(cherry picked from commit 618890f8fa)
2026-08-27 00:25:29 -04:00
Crispin
6ccd26184a Add more 'see also's to header comments in SDL_gpu.h
(cherry picked from commit 1f922d7c06)
2026-08-26 09:13:38 -07:00
Frank Praznik
0a80aefd49 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.

(cherry picked from commit bc0a43ec7f)
2026-08-26 12:07:25 -04:00
sxvlsl
7fc7c9b0e8 joystick: Add VKB Gladiator NXT Evo to the flight stick device list
(cherry picked from commit 6a3062fd6c)
2026-08-26 07:44:28 -07:00
Vlad Zahorodnii
4cbc0b06e2 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.

(cherry picked from commit 5e8eb0d4e7)
2026-08-25 12:42:21 -04:00
muzikbike
8bbdd0d409 Add Wake Up key code for Windows
deduced experimentally via experimentation with consumer hardware

(cherry picked from commit 40e1357e29)
2026-08-24 15:37:50 -07:00
Sam Lantinga
8b7cf83909 Added a Windows mapping for the Gamesir-G5
Fixes https://github.com/libsdl-org/SDL/issues/16190

(cherry picked from commit 6648b7966c)
2026-08-24 13:19:30 -07:00
Sam Lantinga
15fff4770a Added detection for Turtle Beach Xbox 360 controllers
(cherry picked from commit 05a0cb5894)
2026-08-24 13:09:52 -07:00
Eri the Switch
98e0329ad9 joystick: Accept partial user calibration for sticks on Switch controllers
This allows user stick calibration to be applied on JoyCons and possibly
partially user calibrated Pro controllers.

(cherry picked from commit fb8a32cc75)
2026-08-24 09:54:37 -07:00
muzikbike
c6570a4de9 Add some missing Microsoft keyboard codes
Deduced experimentally using https://git.stary.pc.pl/Grzesiek11/w32ev

(cherry picked from commit 9712c2c7fc)
2026-08-24 09:51:33 -07:00
quasar32
32f1edb4b9 Hit test no longer executes when destroying wayland window
Signed-off-by: quasar32 <fontejam32@gmail.com>
(cherry picked from commit be51a15ba2)
2026-08-24 10:48:41 -04:00