Commit Graph

22322 Commits

Author SHA1 Message Date
Frank Praznik
e442a9a5e1 x11: Don't block when withdrawing unmapped windows
Some window managers will mark minimized or offscreen windows as unmapped. When hiding a window, unconditionally call XWithdrawWindow, and don't wait for an UnmapNotify event if the window is already in the unmapped state, or it will block indefinitely waiting for an event that never arrives.
2026-07-15 12:05:00 -04:00
klirktag
8408a664e2 Android: restore the system bars when leaving fullscreen on API 30+
My old PR #15867 switched the fullscreen path to WindowInsetsController.hide() for API 30+, because the legacy setSystemUiVisibility() flags are ignored on API 30+.

The leaving fullscreen path was left untouched: it still calls setSystemUiVisibility(SYSTEM_UI_FLAG_VISIBLE), which is equally ignored on API 30+.

As a result, once fullscreen had hidden the status/navigation bars, they never came back when returning to windowed mode.
2026-07-15 08:15:18 -07:00
rewine
edafd519b9 wayland: bind xdg-decoration-manager-v1 at protocol version 2
v2 removes v1's strict ordering requirement (decoration object must be created and configured before any buffer is attached), allowing xdg_toplevel_decoration to be created even after a buffer has already been attached/committed
2026-07-15 10:35:17 -04:00
Frank Praznik
1a9801a16f cocoa: Clear state on failure to enter fullscreen
A fullscreen exit event doesn't always accompany an entry error, so ensure that all relevant state is cleared if the window fails to enter fullscreen.
2026-07-15 10:32:51 -04:00
Sam Lantinga
2d7f300783 Don't accidentally switch the Horipad Mini into Switch report mode
The PS3 probing switches the HORI Horipad Mini into Nintendo Switch report mode, which we don't recognize since it's still using the Xbox 360 endpoint.
2026-07-14 15:24:49 -07:00
Sam Clegg
31bd4ff77a [emscripten] Remove support for legacy webkitGetUserMedia
This modern navigator.mediaDevices.getUserMedia has been
available since Chrome 53 / Firefox 38 / Safari 11.

See https://github.com/emscripten-core/emscripten/pull/27347
2026-07-14 12:31:15 -07:00
Frank Praznik
8586f63d2a wayland: Refine window raising for new windows
Generate activation tokens for new windows when necessary, and check the hint for activating windows when shown. This will allow new windows to correctly take focus in environments with elevated focus stealing prevention when possible, and it will try to prevent new windows from being activated if the hint is set to false.
2026-07-14 13:33:57 -04:00
Hans-Kristian Arntzen
52ec5120a0 [Video/KMSDRM]: Prefer largest compatible refresh rate by default. 2026-07-14 10:25:28 -07:00
Ryan C. Gordon
758dab45af properties: Fixed a typo in a comment.
(cherry picked from commit 5b5713b955)
2026-07-13 18:39:23 -04:00
Ryan C. Gordon
c9ebec4687 iostream: Create properties on-demand instead of upfront.
It's possible that IOStreams might get created and thrown away a lot, perhaps
at any point in an app's lifetime, so it makes sense to avoid doing the work
of maintaining a properties group for each, if the app hasn't requested it,
since this requires a bunch of allocations and locks.

It's not necessarily worth doing this for other SDL objects, like SDL_Window,
since there are likely to only be a few of them, and likely created at startup
and living for the entire lifespan of the app.

Fixes #14436.
2026-07-13 15:33:08 -07:00
Ryan C. Gordon
daf519ae05 assert: make disabled asserts work with bitfield conditions.
We don't care _what_ the `sizeof` results are, we just want it to vaporize
the condition's code out of the build. So we check it with a `? 1 : 0`, so it
always boils down to a `sizeof (int)`, no matter what data type the condition
actually is.

This works with bitfields, pointers, anything that can be "truthy." If it
isn't truthy, it would fail when assertions are enabled anyhow.

Fixes #15990.
2026-07-13 18:17:33 -04:00
Ozkan Sezer
a6c294410e introduce new printf format macros SDL_PRISZu, SDL_PRISZx and SDL_PRISZX 2026-07-13 22:35:03 +03:00
Sam Lantinga
1f188100bc Added an msys build to the priority build list 2026-07-13 09:24:04 -07:00
Sam Lantinga
80be09a804 Fixed error: unknown conversion type character 'z' in format
That apparently isn't supported by the mingw compiler
2026-07-13 09:22:14 -07:00
Tim Stahlhut
c97d9feb13 Rewrite five SDL_DIRECTX header checks
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

[sdl-ci-filter msvc-*]
[sdl-ci-filter msys2-*]
[sdl-ci-filter cygwin]
[sdl-ci-filter ngage]
2026-07-13 09:07:26 -07:00
Antonio Ospite
b9758218c8 Misc cleanup for src/joystick/hidapi/SDL_report_descriptor.c and new test program (#15959)
* testevdev: Always use decimal for HID report descriptors size

The size of the HID report descriptors in the SDL_COMPILE_TIME_ASSERT
checks is specified sometimes in decimal and sometimes in octal.

Always used decimal for consistency.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* SDL_report_descriptor: Add missing include guards in header file

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* SDL_report_descriptor: Fix some ignored return values

Fix some ignored return values resulting in incomplete error checking.

For instance:

  - ParseMainItem() was always returning true because the return value of
    AddInputFields() was not handled.

  - ParseLocalItem() was always returning true because the return value of
    AddUsage() was not handled.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* test: Add new test program for SDL_report_descriptor code

Add support for testing the SDL_report_descriptor code by adding a new
executable to make it easier to experiment with HID report descriptor
parsing.

The main() function which originally was in
src/joystick/hidapi/SDL_report_descriptor.c is moved to a separate file
named test/testdescriptor.c in order to simplify dealing with multiple
build systems.

For instance if the main() was in
src/joystick/hidapi/SDL_report_descriptor.c the code would have to
account for the cases when the file is built as part of the library or
when it's built as part of a standalone executable, in which case the
dynamic API mechanism needs to be disabled.

This would pose a problem especially with MSVC which uses pre-compiled
headers (PCH) which do not sit well with the preprocessor logic that
would be needed, like the hacks added in test/testevdev.c

Using a completely separate source file for the standalone executable
avoids the issue, especially considering that the new file is not built
with MSVC at all.

The new test program can be built with:

  cmake -DCMAKE_BUILD_TYPE=Debug -DSDL_TESTS=ON -S . -B build
  make -C testdescriptor

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* testdescriptor: Fix compiler warning

Fix compiler warning:

-----------------------------------------------------------------------
.../test/testdescriptor.c: In function ‘main’:
.../test/testdescriptor.c:56:17: warning: unused variable ‘file’ [-Wunused-variable]
   56 |     const char *file = argv[1];
      |                 ^~~~

-----------------------------------------------------------------------

Use the `file` variable when appropriate since it is already declared
and assigned.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* testdescriptor: Clean up descriptor context before exiting

For correctness clean up the descriptor parsing context before exiting,
even though this is not a problem in practice for a standalone
executable.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* testdescriptor: Exercise public API for parsing report descriptor

This gives some more coverage when running the SDL_report_descriptor
test program.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* SDL_report_descriptor: use size_t for variables that represent buffer sizes

Using size_t type for variables that represent buffer sizes in
src/joystick/hidapi/SDL_report_descriptor.[hc] addresses possible errors
when using the functions in combination with SDL_LoadFile, like in
test/testdescriptor.c

When building with CMake on Windows x64 the compilation was failing with
the following error:

-----------------------------------------------------------------------
D:\a\SDL\SDL\test\testdescriptor.c(69): error C2220: the following warning is treated as an error
D:\a\SDL\SDL\test\testdescriptor.c(69): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
-----------------------------------------------------------------------

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

* SDL_hidapi_xboxone: protect against passing negative size to SDL_ReadReportData

Since SDL_ReadReportData() is now using size_t for the buffer size, also
change its user HIDAPI_DriverXboxOne_HandleDescriptorReport to pass
size_t, but protecting against possible cases of passing negative values
to SDL_ReadReportData().

To do that it is enough to check that the "size" argument is not zero,
so it will never be negative when decremented (size--) a few lines
below.

Note: this just addresses a theoretical issue with future callers of
HIDAPI_DriverXboxOne_HandleDescriptorReport, the current code would be
already safe as the current caller already checks that size > 0.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

---------

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
2026-07-13 08:26:03 -07:00
Ryan C. Gordon
d629eb3bf0 vita: Treat the d-pad as a hat switch at the SDL_Joystick level.
Reference Issue #14830.

[sdl-ci-filter *]
2026-07-11 20:33:10 -07:00
Ryan C. Gordon
52ae8796a8 psp: Treat the d-pad as a hat switch at the SDL_Joystick level.
Reference Issue #14830.
2026-07-11 20:33:10 -07:00
Ryan C. Gordon
8c7508decd ps2: Treat the d-pad as a hat switch at the SDL_Joystick level.
Reference Issue #14830.
2026-07-11 20:33:10 -07:00
Ryan C. Gordon
fb3afd33e4 n3ds: Treat the d-pad as a hat switch at the SDL_Joystick level.
Reference Issue #14830.
2026-07-11 20:33:10 -07:00
Ryan C. Gordon
82141a2439 api: Added SDL_GetNumProperties().
Fixes #14761.
2026-07-11 15:11:30 -04:00
Nintorch
d11e3e087a Emscripten: Convert joystick axis 9 to a hat 2026-07-11 08:01:10 -07:00
Anonymous Maarten
891808e128 cmake: add missing cmake_pop_check_state to gameinput checks 2026-07-11 16:45:17 +02:00
Sam Lantinga
9149eca207 testffmpeg_vulkan: enable the VK_KHR_video_maintenance1 extension
This is used by ffmpeg, so we'll enable it if it's available
2026-07-10 11:40:30 -07:00
Sam Lantinga
094213b3be testffmpeg_vulkan: fixed goto jump past variable initialization 2026-07-10 10:07:50 -07:00
Sam Lantinga
4a00b98c91 testffmpeg: added a --nodelay command line option 2026-07-10 10:06:48 -07:00
Sam Lantinga
573fc51938 testffmpeg_vulkan: use C++ compatible code structure 2026-07-10 10:06:48 -07:00
Sam Lantinga
6ce3d843fc testffmpeg_vulkan: fixed usage of timeline semaphores 2026-07-10 10:06:48 -07:00
Sam Lantinga
c1d4376d3c Fixed Vulkan validation errors when using ffmpeg video decode 2026-07-10 08:09:15 -07:00
Ozkan Sezer
f653c5e91c update khronos headers from mainstream. 2026-07-10 03:55:50 +03:00
Ryan C. Gordon
e7be7d844a vulkan: Make SDL_Vulkan_GetInstanceExtensions more robust.
Now it handles NULL `count` params at the higher level, and doesn't explode if
a backend doesn't implement it.
2026-07-09 17:28:07 -04:00
Tim Stahlhut
bb74b618ac Cygwin: Reduce warning
[sdl-ci-filter cygwin]
[sdl-ci-filter msys2-*]
[sdl-ci-filter msvc-*]
2026-07-09 09:03:46 -07:00
SDL Wiki Bot
50852f7f1b Sync SDL3 wiki -> header
[ci skip]
2026-07-08 23:11:32 +00:00
Sam Lantinga
782d6bc116 Note that Windows doesn't see mouse button releases when RIDEV_NOLEGACY is active. 2026-07-08 16:08:38 -07:00
palxex
fed7f6fe06 perf: fast-path pure palette animation for dos 2026-07-08 11:09:21 -07:00
Epifanov Ivan
425c6a2695 VITA: invalidate texture in render state on update (#15957) 2026-07-08 07:10:57 -07:00
meta-legend
e90bdfb5ea Avoid unnescessarily updating fullscreen display modes 2026-07-07 21:36:28 -07:00
ExtremelyLazyCat
5403934fd3 Add Mayflash N64 Controller Adapter mapping 2026-07-07 14:04:56 -07:00
Frank Praznik
a3a8141557 wayland: Simplify key repeat handling
Remove redundant state variables, remove trivial helper functions, and guard against the unlikely case where a compositor may set the repeat rate to zero while a repeat is active, which would result in a divide-by-zero error.

Key repeat is increasingly handled server-side with seat v10 and above, so consider that the most common path for the future.
2026-07-07 15:02:16 -04:00
Sam Lantinga
cf6a235a41 Only skip the Flydigi driver when checking to see if a device is handled by HIDAPI 2026-07-07 09:30:20 -07:00
Isabella Basso
1f3f714393 cocoa: restore discrete mouse wheel ticks 2026-07-07 10:44:51 -04:00
Gabriel Wang
7afd6c3497 Add sve2 acceleration for blit2to2 key (#15953) 2026-07-07 07:36:07 -07:00
Sam Lantinga
c0efc5862c Use the correct protocol for the PDP Afterglow Wave controller
Third party wireless controllers use the full Switch Pro protocol over Bluetooth and third party wired controllers use the input-only protocol.

The PDP Afterglow Wave Controller for Switch uses the same VID/PID for both wired and wireless variants, so we need to look at the connection type to determine what protocol to use.
2026-07-06 18:47:46 -07:00
Sam Lantinga
03f81ab4aa Fixed the 8BitDo Pro 3 controller showing up twice on macOS
Fixes https://github.com/libsdl-org/SDL/issues/15890
2026-07-06 17:03:23 -07:00
Sam Lantinga
ce417a40cf Start text input before showing the on-screen keyboard (thanks @sharkwouter!)
Fixes the on screen keyboard not sending an event the first time on PSP

Closes https://github.com/libsdl-org/SDL/pull/15950
2026-07-06 16:44:59 -07:00
Sam Lantinga
bd55a6d67d Fixed pressing back paddles and D-pad simultaneously on the GameSir-G7 Pro 8K controller 2026-07-06 16:35:24 -07:00
SDL Wiki Bot
eb88a154fa Sync SDL3 wiki -> header
[ci skip]
2026-07-06 20:30:33 +00:00
Sam Lantinga
d8d5b7c6c5 Added a slider to manually adjust HDR headroom on visionOS
Ideally the OS would provide a way to query the current headroom, but for now users can manually adjust it.
2026-07-06 13:25:12 -07:00
palxex
ac6e7c795e dos: Drain BIOS keyboard buffer in event pump to prevent overflow beeps 2026-07-06 13:32:30 -04:00
brentfpage
46dcc0c554 for 'pinch end' events on mobile devices, send dummy value -1 for (focus|span)_(x|y) 2026-07-06 05:52:47 -07:00