Commit Graph

19385 Commits

Author SHA1 Message Date
expikr
dd625a6763 defer clipcursor refresh unto pump finish 2025-04-24 10:36:29 -07:00
expikr
c84c2aa2c4 pass ground-truth cursor pos to WIN_UpdateFocus 2025-04-24 10:36:29 -07:00
Frank Praznik
11a3296a42 x11: Handle size/position events arriving before state events
Xfce, unlike every other window manager in existence, sends ConfigureNotify events before PropertyNotify events when toggling the fullscreen and maximized window state. Check the window state when handling ConfigureNotify events, and defer emitting SDL size/position events until the corresponding PropertyNotify event arrives, since SDL and clients expect to get the window state before the new size and position.
2025-04-24 12:28:40 -04:00
Maia
d50520462a Add and use SDL_HapticEffectID typedef 2025-04-24 08:51:55 -07:00
Frank Praznik
fb940fff80 audio: Fix warning C4701: potentially uninitialized local variable 'isstack' used
This warning is actually wrong, as the variable is only used if the string pointer is valid, in which case it was initialized, but this is needed to quiet MSVC.
2025-04-24 10:49:10 -04:00
Ryan C. Gordon
e8bd9cc150 audio: SDL_GetAudioDeviceName() doesn't need a full device lock.
Fixes https://github.com/libsdl-org/sdl2-compat/issues/468
2025-04-24 10:30:25 -04:00
Eri the Switch
3343cb2147 gpu: rework alpha-to-coverage validation 2025-04-23 19:28:11 -07:00
Vicki Pfau
ceb9fecfc1 Joystick: Add trigger rumble resend
This was already present for regular rumble to ensure that controllers would
continue rumbling for extended periods, but was missing for trigger rumble. I
don't know if this affects any controllers at the moment, but it's helpful for
future-proofing.
2025-04-23 19:23:11 -07:00
Logan Benjamin
c81b62293a GPU D3D12 - Update to use typeless formats for depth buffer (#12701)
For a depth buffer in D3D12 that is also going to be used in a texture sampler, the creation (on an Intel HD 5500 igpu) fails. e.g. SDL_GPUTextureCreateInfo type = TEXTURE_2D, format = D32_FLOAT, usage = DEPTH_STENCIL_TARGET | SAMPLER

The error messages are:

D32_FLOAT
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The Format (0x29, R32_FLOAT) is invalid when creating a View; the
Resource was already created with a fully qualified Format, which is not castable (0x28, D32_FLOAT).

D24_UNORM
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: For the resource format D24_UNORM_S8_UINT, when making a D3D view, the format name for the view can't be R24_UNORM_X8_TYPELESS.

I found this is because the texture format needs to be created as _TYPELESS, then the views (depth stencil view, shader resource view) should then be created as their respective types - e.g. texture = R32_TYPELESS, dsv = D32_FLOAT, srv = R32_FLOAT

Tested and working on:
NVidia RTX 3050 (D3D12 feature set 12_2)
Intel HD 5500 (D3D12 feature set 11_1)
2025-04-23 16:30:16 -07:00
Petar Popovic
27b256022b SDL_GetRectIntersectionFloat(): Allow rendering zero-sized srcrect 2025-04-23 16:14:52 -07:00
Lucas Murray
d04b28926c GPU: Make D3D12 debug layers optional 2025-04-23 15:57:48 -07:00
Sam Lantinga
695cad459b Corrected documentation for SDL_SetGPUSwapchainParameters() 2025-04-23 14:54:12 -07:00
Maia
2b16c961ea Add and use typedefs SDL_HapticEffectType and SDL_HapticDirectionType 2025-04-23 12:08:21 -07:00
Frank Praznik
a1332d77f6 wayland: Cleanup timestamp handling
Better handle some very rare, but possible edge cases if the system has been running for many days.
2025-04-23 12:35:51 -04:00
Ozkan Sezer
b5ed0d0138 stb_image.h: apply mainstream PR/1736
Fix root-cause of CVE-2021-45340 : dereference of NULL ptr.
Patch authored by Henner Zeller <h.zeller@acm.org>
Mainstream pull request: https://github.com/nothings/stb/pull/1736
2025-04-23 17:55:02 +03:00
SDL Wiki Bot
e3181a0bcd Sync SDL3 wiki -> header
[ci skip]
2025-04-23 03:31:45 +00:00
Ryan C. Gordon
e3507b390e examples: added audio/05-planar-data 2025-04-22 23:30:50 -04:00
Ryan C. Gordon
3905aa0587 audio: Added SDL_PutAudioStreamPlanarData.
Fixes #12846.
2025-04-22 23:30:50 -04:00
Ryan C. Gordon
483d1c36ed comments: Fixed a few typos I ran into in the audio code. 2025-04-22 19:40:40 -04:00
SDL Wiki Bot
727a5fae59 Sync SDL3 wiki -> header
[ci skip]
2025-04-22 21:34:48 +00:00
Sam Lantinga
5a8be8e4c2 Fixed formatting 2025-04-22 14:33:47 -07:00
Lucas Murray
6e4ace310c GPU: Validate shader bytecode 2025-04-22 13:07:37 -07:00
Sam Lantinga
89d7d406ab Added tests to cover invalid surface blits
Reproduction case for https://github.com/libsdl-org/SDL/issues/12844
2025-04-22 13:05:38 -07:00
Petar Popovic
fe849f1572 SDL_BlitSurfaceScaled(): Do not divide by zero 2025-04-22 13:02:40 -07:00
Petar Popovic
8017d38adc SDL_BlitSurfaceScaled(): Do not blit if surfaces have no pixel data 2025-04-22 13:00:39 -07:00
Sam Lantinga
18fbe6a92f Renamed SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 to SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER
Typically we will name the property with the function that is used to set it, and document the range of values.
2025-04-22 10:28:20 -07:00
SDL Wiki Bot
6a6917b0df Sync SDL3 wiki -> header
[ci skip]
2025-04-22 17:25:51 +00:00
Maia
e70a49892b Add missing type suffix to SDL_PROP_WINDOW_OPENVR_OVERLAY_ID 2025-04-22 10:25:02 -07:00
Petar Popovic
a696b108ac SDL_BlitSurface() comment: Remove sentence about final blit rect being stored in srcrect and dstrect 2025-04-22 10:21:36 -07:00
Sam Lantinga
c076b0d17f Removed incorrect documentation for SDL_RenderViewportSet()
Closes https://github.com/libsdl-org/SDL/pull/12854
2025-04-22 10:17:11 -07:00
Cameron Gutman
47162a4168 x11: Send key events for dead keys consumed by the IME
This matches the Wayland backend and what apps originally written for SDL2 are expecting.
2025-04-22 09:18:23 -07:00
Sam Lantinga
3aed80cd82 Updated documentation for SDL_HINT_GPU_DRIVER 2025-04-22 08:58:44 -07:00
Frank Praznik
86b3369491 wayland: Check the origin of clipboard offers before forwarding them to the client
Wayland compositors may send recursive clipboard offers to the client, which need to be filtered out to avoid clearing local data. Previously this was worked around with a hack, but this caused the ownership flag to be set incorrectly, which broke some clients.

This introduces a metadata MIME type of application/x-sdl3-source-id to be sent with SDL3 selection offers, which contains a string that is a unique identifier for the instance, and can be used to detect if a received selection offer is originating from the same instance that generated it.

If DBus is available, the unique identifier string is the unique name of the connection, otherwise, the process ID is used.
2025-04-22 11:29:38 -04:00
SDL Wiki Bot
23a7a74133 Sync SDL3 wiki -> header
[ci skip]
2025-04-22 14:50:56 +00:00
SDL Wiki Bot
3be0ec5631 Sync SDL3 wiki -> header
[ci skip]
2025-04-22 14:46:54 +00:00
Frank Praznik
5bd1578a45 wayland: Account for timer rollover when calculating the elapsed time for key repeats.
The 32-bit millisecond timer can roll over after about 49 days, so this needs to be accounted for.
2025-04-22 10:26:40 -04:00
Frank Praznik
10f51da28d cocoa: Use CGFLOAT_MAX for unbounded max window dimensions 2025-04-21 21:02:01 -04:00
Maia
3519a59d8f The SDL_BUTTON_*MASK defines must come immediately after the SDL_MouseButtonFlags typedef to be associated 2025-04-21 14:24:23 -07:00
SDL Wiki Bot
8e0b39f465 Sync SDL3 wiki -> header
[ci skip]
2025-04-17 18:06:43 +00:00
Frank Praznik
9da46bc37f win32: Check internal data when positioning child windows
Under certain circumstances, processing events may try to position a child before it is fully initialized. Check the internal data before proceeding.
2025-04-16 12:49:50 -04:00
SDL Wiki Bot
90fd2a3cbe Sync SDL3 wiki -> header
[ci skip]
2025-04-13 16:33:01 +00:00
Frank Praznik
edd08771a9 wayland: Add xdg_toplevel v7 edge constraint support
If a window isn't resizable from specific directions, the compositor can inform clients of the current edge constraints, so they don't display resize cursors for non-resizable edges.
2025-04-13 11:10:49 -04:00
Frank Praznik
113475acbd wayland: Add multi-seat support
Wayland environments can expose more than one seat for multiple collections of input devices, which can include multiple, simultaneously active, desktop pointers and keyboards with independent layouts. The Wayland input backend previously presumed that only one seat could exist, which caused broken behavior if the compositor exposed more than one, which is possible on wlroots based compositors such as Sway. This introduces support for handling multiple seats, including proper handling of dynamically added and removed seats and capabilities at run time.

The SDL Wayland input system was accreted over time, and the assumption that only one seat will ever exist resulted in state and related objects not always being tied to their most appropriate owner in a multi-seat scenario, so refactoring was required to manage several bits of state per-seat, instead of per-window or globally.

As Wayland keyboards can have per-seat layouts, fast keymap switching is required when multiplexing input from multiple seats to the global SDL keyboard device. A parameter was added to the keymap creation function to specify if the keymap lifetime should be externally managed to facilitate keymap reuse, and some layout info was moved from the global keyboard state to the keymap state to avoid unnecessarily redetermining it whenever a reused keymap is bound. This reduces the overhead of switching keymaps to setting a single pointer.

Multiple seats also means that multiple windows can have keyboard and/or mouse focus at the same time on some compositors, but this is not currently a well-handled case in SDL, and will require more work to support, if necessary.
2025-04-12 13:39:17 -04:00
Sam Lantinga
4093e4a193 Fixed process I/O redirection to NUL on Windows 2025-04-11 15:44:58 -07:00
Sam Lantinga
c025fdbb7c Add the CREATE_NO_WINDOW flag for background processes
Fixes https://github.com/libsdl-org/SDL/issues/12097
2025-04-11 15:44:58 -07:00
Sam Lantinga
8a57c83ff9 Updated to GameInput v1.1
The biggest change is that the C API is no longer available.

Here are more details:
https://www.nuget.org/packages/Microsoft.GameInput

Fixes https://github.com/libsdl-org/SDL/issues/12802
2025-04-11 13:42:58 -07:00
Sam Lantinga
f35a2736b7 Don't reset the render target when invalidating GPU renderer cache state
Fixes https://github.com/libsdl-org/SDL/issues/12646
2025-04-11 09:23:02 -07:00
SDL Wiki Bot
47e52ab37b Sync SDL3 wiki -> header
[ci skip]
2025-04-10 17:53:43 +00:00
SDL Wiki Bot
6a3dbe34d5 Sync SDL3 wiki -> header
[ci skip]
2025-04-10 17:52:25 +00:00
SDL Wiki Bot
d84c000ac5 Sync SDL3 wiki -> header
[ci skip]
2025-04-10 17:25:30 +00:00