Commit Graph

12412 Commits

Author SHA1 Message Date
Sam Lantinga
b16ad6f10f Allow any init flags to be passed to SDLTest_CommonCreateState() 2025-10-15 21:57:37 -07:00
Sam Lantinga
6109fa6794 The names of joysticks and gamepads are valid after they've been removed 2025-10-15 21:57:37 -07:00
nmlgc
5e1a753f88 windowsdialog: Fix broken ≤XP fallback declarations
The syntax errors in the enum lists tell us that no one ever actually
compiled this `WINVER < _WIN32_WINNT_VISTA` fallback path. 2f5bc17 made
it increasingly unlikely for retro Windows builds to hit this path by
adding a new set of `WINVER` override rules to `SDL_windows.h` that
check for the presence of certain headers. `HAVE_MMDEVICEAPI_H` in
particular will be `#define`d for any CMake build with a ≥Vista-era
SDK, such as Visual Studio 2017's `v141_xp` toolset that 2f5bc17
targeted, and it's also unconditionally defined in the default
`SDL_build_config_windows.h` configuration used by the ready-made
Visual Studio project.

These fixes work for a XP-era configuration that undefines all of the
`HAVE_*_H` macros and `SDL_VIDEO_RENDER_D3D12` to make `SDL_windows.h`
fall through to the `#define _WIN32_WINNT _WIN32_WINNT_WINXP` case, on
both Visual Studio 2022 and Visual Studio 2017's `v141_xp` toolset.
2025-10-15 21:17:59 -07:00
Frank Praznik
dcb8a6521c Add animated cursor support
Adds support for animated cursors on Cocoa, Wayland, Win32, and X11.

testcursor can take a semicolon separated list of filenames and load an animated cursor from them.
2025-10-15 14:41:15 -04:00
Frank Praznik
69692de8b8 wayland: Refactor animated cursor handling
Generalizes the animated cursor info, so it can be used for custom cursors as well.
2025-10-15 14:41:15 -04:00
nmlgc
2ffabb5150 render: Fix texture format selection for color-keyed indexed surfaces
015cc6a broke texture format selection for this kind of surface if the
renderer's first texture format doesn't happen to have an alpha
channel. This happens for on-screen software renderers on Windows,
whose preferred format is the window's own `SDL_PIXELFORMAT_XRGB8888`.
This fixed check also cover the intent behind 015cc6a, assuming that
indexed and alpha formats are mutually exclusive.
2025-10-14 21:23:09 -07:00
Peter0x44
705ced8cf5 Make D3D math functions static inline to reduce likelihood of linking conflicts
Convert SDL_d3dmath.c functions to static inline in SDL_d3dmath.h to make
it less likely to conflict when static linking SDL. raylib's SDL backend
does not work with a "normal" upstream binary static link. It has these
errors:

/usr/bin/ld: /usr/local/lib64/libSDL3.a(SDL_d3dmath.c.o): in function `MatrixIdentity':
SDL/src/render/SDL_d3dmath.c:35: multiple definition of `MatrixIdentity'; CMakeFiles/raylib.dir/rcore.c.o:rcore.c:(.text+0x18470): first defined here
/usr/bin/ld: /usr/local/lib64/libSDL3.a(SDL_d3dmath.c.o): in function `MatrixMultiply':
SDL/src/render/SDL_d3dmath.c:44: multiple definition of `MatrixMultiply'; CMakeFiles/raylib.dir/rcore.c.o:rcore.c:(.text+0x18540): first defined here
collect2: error: ld returned 1 exit status

It works if these functions aren't emitted, (i.e.
!SDL_VIDEO_RENDER_D3D(11|12|GPU|VULKAN)

Or, if SDL is not linked static. Which I know is preferred anyway.

In raylib's case, it doesn't use this code anyway so it's not a problem
to build it yourself with them disabled. But it's a minor hassle to be
incompatible with static linking libraries from upstream.

I can't see any good reason for these functions to not be static inline
already, so I just put them in the header and deleted the .c.

Raylib's conflicting case is a library with a public function exposed to
users. But SDL's case is not.

- Moved all matrix functions from SDL_d3dmath.c to SDL_d3dmath.h as static inline
- Removed SDL_d3dmath.c from all project files (Visual Studio and Xcode)
- Functions affected: MatrixIdentity, MatrixMultiply, MatrixScaling,
  MatrixTranslation, MatrixRotationX, MatrixRotationY, MatrixRotationZ
2025-10-14 16:56:41 -07:00
Oleksandr Manenko
901173aee6 Fix thread safety attributes for TryLock functions
Changed SDL_TRY_ACQUIRE and SDL_TRY_ACQUIRE_SHARED success value
from 0 to true for functions that now return bool instead of int.
This fixes false positives/negatives in Clang's thread safety analysis.
2025-10-14 12:47:20 -07:00
Sam Lantinga
f844f3e10b Only pass UIPress from game controllers and remotes if the're not open
Fixes https://github.com/libsdl-org/SDL/issues/14080
2025-10-14 12:43:22 -07:00
Ryan C. Gordon
4ece6993fe uikit: Apple Pencil is always a "direct" input device.
Fixes #13065.
2025-10-14 13:59:27 -04:00
Sam Lantinga
d819106c65 Try matching gamepad mappings with CRC first
Fixes https://github.com/libsdl-org/SDL/issues/13874
2025-10-14 10:30:03 -07:00
Sam Lantinga
98944ecd0c Added the 8BitDo Ultimate 2C Wireless Controller to the Xbox controller list
Fixes https://github.com/libsdl-org/SDL/issues/14127
2025-10-13 18:46:58 -07:00
Susko3
e2bbbdc515 Implement SDL_GetPenDeviceType() for Android 2025-10-13 18:43:16 -04:00
Sam Lantinga
015cc6aa6c Fixed accidentally using INDEX8 textures for RGB24 surfaces 2025-10-13 15:27:13 -07:00
Sam Lantinga
7a49ce71a1 Handle partial OpenGL shader availability
The pixelart shaders are not supported on OpenGL 2.1 (GLSL 130 isn't available)

Fixes the OpenGL renderer on macOS
2025-10-13 15:27:13 -07:00
Sam Lantinga
a58ae3a94f Added WASAPI support for SDL_HINT_AUDIO_DEVICE_STREAM_ROLE
Also added SDL_HINT_AUDIO_DEVICE_RAW_STREAM

Fixes https://github.com/libsdl-org/SDL/issues/14091
2025-10-13 14:20:19 -07:00
Evan Hemsley
20206b8e66 GPU: Correctly recycle D3D12 descriptor heaps (#14234) 2025-10-13 13:00:00 -07:00
Frank Praznik
228a7d8e54 wayland: Better handle event times that cross zero
Detect times that cross forward/backward across the zero timepoint, and handle them appropriately, so that events with an old timestamp don't mangle the time base offset, or have their timestamps mangled.
2025-10-13 14:51:27 -04:00
cosmonaut
b067dfa345 GPU: Validate that buffer size is at least 4 bytes 2025-10-13 11:04:59 -07:00
Sam Lantinga
361f7e0873 Fixed power state reporting for the Nintendo Joy-Con Charging Grip 2025-10-13 10:34:22 -07:00
Sam Lantinga
6b5b0ca90a Fixed header include guards 2025-10-13 09:46:15 -07:00
Brenton Bostick
e584d2a8a9 fill-in missing DeleteLocalRef calls 2025-10-13 09:28:29 -07:00
Frank Praznik
6f81c70f67 wayland: Clean up gesture support
The gesture capability is tied to the pointer capability, not touch, and may not always be exposed by the compositor.
2025-10-13 12:00:14 -04:00
Sam Lantinga
831ec4dc6c Added support for the ZENAIM ARCADE CONTROLLER 2025-10-13 08:56:10 -07:00
Mitch Cairns
23356e1483 SInput: Fix paddle order
For SInput, the paddle order is left/right, which conflicted with the paddle order 1/Right, 2/Left.
The order has been fixed to properly apply the mapping strings generated to be 2/Left, 1/Right, 4/Left, 3/Right.
2025-10-13 08:18:25 -07:00
Ryan C. Gordon
72a3e4084a testsymbols: Use the existing symbol list in SDL_dynapi_procs.h 2025-10-13 10:58:03 -04:00
Anonymous Maarten
a472f5ea1e Fix MSVC syntax error
Fixes the following error:
`
error C2059: syntax error: '}'
`
2025-10-13 01:19:17 +02:00
Sylvain Becker
71bf56c9e4 Add SDL Pinch events (#9445) 2025-10-12 14:44:23 -07:00
Sam Lantinga
d7ad47e2ca Added SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 11:15:47 -07:00
Sam Lantinga
513de0f0ec Don't allow SDL_TEXTURE_ADDRESS_WRAP if it's not supported
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 10:46:48 -07:00
Sam Lantinga
1ed093ad8b Corrected texture colors on PS2 (thanks @Trinth!)
Fixes https://github.com/libsdl-org/SDL/issues/12395
2025-10-12 09:20:00 -07:00
Stéphane GINIER
5dab2c73f0 MacOS: improve scroll smoothing
Use scrollingDelta instead of delta, as recommended by the Apple documentation.
It gives much smoother scrolling.
2025-10-11 20:56:50 -07:00
Sam Lantinga
70eceec77b Replace stb_image_write with miniz for SDL_SavePNG()
Fixes https://github.com/libsdl-org/SDL/issues/14219
2025-10-11 20:32:19 -07:00
Vicki Pfau
c89fed4eae switch2: Preliminary rumble support
Fused controller support is somewhat lacking, and the scaling and frequency
on rumble is somewhat arbitrary, but otherwise it works fine.
2025-10-11 14:04:52 -07:00
Vicki Pfau
ef99341691 switch2: Move initialization after reading calibration
This removes the need to wait for initialization to finish
2025-10-11 14:04:52 -07:00
Vicki Pfau
70bfdd013a switch2: Send full init sequence from real hardware 2025-10-11 14:04:52 -07:00
Vicki Pfau
cdc1922801 switch2: This is the zero point, not the max 2025-10-11 14:04:52 -07:00
Sam Lantinga
480f069cec Copy the palette instead of referencing it when creating a texture
Fixes https://github.com/libsdl-org/SDL/issues/14213
2025-10-11 11:01:15 -07:00
Gustaf Alhäll
2c63bc7315 Fix SDL_SetRelativeMouseMode failing with software framebuffer on Haiku 2025-10-11 09:02:27 -07:00
Ryan C. Gordon
c508239e91 emscripten: Add a stub SetWindowResizable implementation.
This is needed or SDL_SetWindowResizable won't let you change the window's
SDL_WINDOW_RESIZABLE flag.

Fixes #12405.
2025-10-11 11:46:15 -04:00
Ryan C. Gordon
f556027e15 hints: Remove SDL_HINT_DEBUG_LOGGING.
This now just needs generic debug-level logging enabled, for example:

```bash
SDL_LOGGING=debug ./test/testsprite
```

Fixes #13425.
2025-10-10 21:55:48 -04:00
Ryan C. Gordon
6ab212bd13 cpuinfo: Include unistd.h for getpagesize() support, too. 2025-10-10 21:52:41 -04:00
Ryan C. Gordon
f7d5bb3c7a cpuinfo: Added SDL_GetSystemPageSize.
Fixes #14201.
2025-10-10 21:16:10 -04:00
Sam Lantinga
9d635fe641 Flush rendering if a texture palette is in use when destroyed 2025-10-10 17:42:27 -07:00
Sam Lantinga
3fcac8cc44 Added support for CF_DIBV5 and PNG clipboard formats on Windows 2025-10-10 17:42:27 -07:00
Ozkan Sezer
2603565993 SDL_gtk.c: make private procedure signal_connect() static 2025-10-11 02:51:14 +03:00
Ozkan Sezer
ae7643e8ae SDL_fribidi.h: include sys/types.h for ssize_t.
also remove fribidi.h include from SDL_fribidi.c (already included
by SDL_fribidi.h) and do style clean-up.
2025-10-11 02:50:20 +03:00
Ryan C. Gordon
1191f81a3c camera: Make refcounts more robust, and actually destroy disconnected cameras.
Fixes #14049.
2025-10-10 16:21:59 -04:00
Sam Lantinga
ee622c570a Made SDL_dlopennote.h a public header 2025-10-10 12:47:42 -07:00
Sam Lantinga
1871b998cd Added SDL_EVENT_SCREEN_KEYBOARD_SHOWN and SDL_EVENT_SCREEN_KEYBOARD_HIDDEN
Fixes https://github.com/libsdl-org/SDL/issues/13049
2025-10-10 10:14:07 -07:00