Commit Graph

12502 Commits

Author SHA1 Message Date
Majjcom a576a4af2d Windows: Fix window caption drawing on borderless windows
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 4b69833bc5)
2026-05-04 08:34:03 -07:00
Stanislav Aleksandrov c4d6a01383 video: NULL-check display in SDL_DestroyWindow
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 039a60c527)
2026-04-28 08:02:04 -04:00
Cameron Gutman 9e347006d5 atomic: Fix infinite recursion in SDL_CompilerBarrier() fallback
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.

(cherry picked from commit d07d39b0da)
2026-04-27 20:27:31 -05:00
Cameron Gutman c32082c94a atomic: Fix and cleanup SDL_UnlockSpinlock()
- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove Watcom and MSVC x86/x64 cases which are now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking

(cherry picked from commit 3ebdcc5b1c)
2026-04-27 20:27:31 -05:00
Cameron Gutman 7b377a54b9 atomic: Use __atomic_signal_fence() for SDL_CompilerBarrier()
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is the (slightly) more standard way to accomplish it.

(cherry picked from commit dd1e04eedf)
2026-04-26 22:09:23 -05:00
Cameron Gutman 01b0e1a407 atomic: Fix memory barriers on MSVC ARM32/ARM64
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 26616cd653)
2026-04-24 21:31:20 -05:00
Cameron Gutman 6c5a82ba77 atomic: Use acquire/release InterlockedExchange intrinsics on ARM64EC
(cherry picked from commit 15275898f0)
2026-04-24 19:08:33 -05:00
Cameron Gutman 565ed27620 Fix UWP build
(cherry picked from commit 157ca95985)
2026-04-24 18:55:58 -05:00
Cameron Gutman 34742887ef atomic: Use DMB ISHLD for aarch64 acquire barrier
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is a little more efficient than a DMB ISH and matches what
GCC, Clang, and MSVC generate for a C++11 acquire fence.

(cherry picked from commit 7751494160)
2026-04-23 21:39:05 -05:00
Cameron Gutman 4bce8906fc atomic: Use __atomic_thread_fence() when available
This avoids requiring inline assembly for each architecture.

It also fixes some weakly ordered architectures which lacked
said inline assembly (RISC-V, MIPS, LoongArch, etc) and were
thus disasterously broken.

(cherry picked from commit c3b0e62850)
2026-04-23 19:00:21 -05:00
atirado.net f32c6d977c Backport VIRPIL Controls device IDs to SDL2
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Backport of SDL3 fix (libsdl-org/SDL#15418).

VIRPIL Controls (VID 0x3344) flight sticks are
misclassified as gamepads by SDL's axis-count
heuristic because they report exactly 6 axes,
matching SDL_GAMEPAD_AXIS_COUNT. Adding them to
the appropriate device lists ensures correct
classification.

Tested on Linux (Fedora 43, kernel 6.19) with:
- R-VPC Stick MT-50CM3 (PID 0x4391)
- L-VPC Stick MT-50CM3 (PID 0x8390)
- VPC VMAX Prime Throttle (PID 0x0196)

(cherry picked from commit c8ebb1456e)
2026-04-21 08:25:15 -07:00
Cameron Gutman 21ac66c8b3 atomic: Fix missing full memory barrier on GCC/Clang
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
__sync_lock_test_and_set() is designed for creating locks, not as
a general atomic exchange function. As a result, it only provides
an acquire memory barrier and isn't guaranteed to actually store
the provided value (though it does on architectures we care about).

__atomic_exchange_n() is supported on GCC/Clang for the last ~10
years, so let's use that instead if available. We will keep the
__sync_lock_test_and_set() fallback around for ancient platforms,
but add a full memory barrier to match the documented behavior.

(cherry picked from commit 30de669b32)
2026-04-20 06:36:50 -04:00
Ryan C. Gordon 1549cd38e6 CLAUDE.md: Just copy the text from AGENTS.md in here for now.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Someone mentioned that Claude sees this file's previous text and adds "look at
AGENTS.md" to it's TODO list instead of treating it as the thing it should do
first.

If everything decides to prefer AGENTS.md at some point, we'll delete this
file.

A symlink would apparently also work, but it would be the only symlink in the
SDL git repo, so it seemed less disruptive to just copy the file over for now.

(cherry picked from commit 847fc72b1b)
2026-04-16 13:56:28 -04:00
Ryan C. Gordon 071a484703 CLAUDE.md: added.
Apparently Claude Code won't read AGENTS.md by default at this moment, but
since that's the direction we're moving, let's just add the file Claude
currently looks for and tell it that the actual instructions are in AGENTS.md.

I thought these things were supposed to be less complicated that interacting
with humans, lol.

(cherry picked from commit 1124e44e4c)
2026-04-16 12:23:42 -04:00
Ryan C. Gordon 3132e9302b AGENTS.md: Change "may not" to "must not".
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(Hat tip to Sean Barrett on the stronger wording here.)

(cherry picked from commit 5bda0ccfb0)
2026-04-15 17:28:59 -04:00
Ryan C. Gordon de90addb43 policy: Clarify that "AI" means specific things.
(cherry picked from commit 954e2f3354)
2026-04-15 17:28:54 -04:00
Ryan C. Gordon a9033bbad0 policy: Updated AI-related text based on excellent feedback.
(cherry picked from commit 4711119605)
2026-04-15 17:28:50 -04:00
Ryan C. Gordon 4e75780e75 policy: Added to the PR template, and an AGENTS.md, refusing AI contributions.
Fixes #15350.

(cherry picked from commit 08285d828e)
2026-04-15 17:28:47 -04:00
Cameron Gutman 1c4ea7da64 kmsdrm: Fix order of GBM and EGL teardown
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.

(cherry picked from commit 9cc2f248f5)
2026-04-10 19:29:05 -05:00
Craig Chandler 5297f5a772 Android: use RECEIVER_NOT_EXPORTED for receivers on API 33+
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 88017f5023)
2026-04-06 23:14:10 -07:00
Sam Lantinga 473efcf53c Added a hint "SDL_SURFACE_MALLOC" to disable aligned surface allocation
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is needed for sdl12-compat, where all surfaces were not aligned.

(cherry picked from commit dd01e096e9)
2026-04-02 10:37:20 -07:00
Anonymous Maarten 47aae3e16d ci: clang-tidy is not used
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 70584e55a1)
2026-03-25 19:06:57 +01:00
Ozkan Sezer 87efb7e862 cmake: add OS2 to OPT_DEF_LIBC enable list.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 738b1e4f47)
2026-03-20 07:33:20 +03:00
Ozkan Sezer 645fbb6a22 libtool.m4: remove old_archive_from_new_cmds on os2
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes the static library and 'make install' issues.
From https://github.com/komh/libtool-os2

(cherry picked from commit e107aece34)
2026-03-19 11:01:14 +03:00
Ozkan Sezer 40472f053b apply issue/#13952 fix to SDL_cpuinfo.h, too.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit e0307aa05e)
2026-03-17 17:01:10 +03:00
Ozkan Sezer 549934b59a minor os/2 emx build fix.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit a7d4b1996f)
2026-03-17 05:03:10 +03:00
Ozkan Sezer 795168f6a8 libtool.m4: Use echo in archive_cmds and archive_expsym_cmds on OS/2
Fixes that building DLLs fails because $ECHO does not work when it's
set to "printf %s\n".
From https://github.com/komh/libtool-os2

(cherry picked from commit 1e1e982ae7)
2026-03-17 04:55:50 +03:00
Ozkan Sezer bdef7ef9d8 SDL_dynapi.c, os/2: remove unnecessary include.
(cherry picked from commit e7e24a1ee5)
2026-03-17 00:20:50 +03:00
Tobiasz Laskowski 9324f9eb55 Backport android api 30+ fix for backspace to SDL2
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 22a6d76f22)
2026-03-03 22:51:51 -08:00
hexnet1234 6e43302694 Fix Wayland_DestroyWindow SEGFAULT
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Check if the wind pointer is NULL, to avoid SEGFAULT.
Already implemented in SDL3, but not yet backported.
2026-02-26 10:02:45 -05:00
Alexandre Derumier 57462dad9c Correct the sensor axis ordering with the Linux Nintendo driver
Fixes https://github.com/libsdl-org/SDL/issues/14552

Manual cherry-pick of 5e9163592f by Sam Lantinga <slouken@libsdl.org>
2026-02-12 11:33:32 -08:00
Wohlstand 07bf82e39e SDL_render_psp.c: Also apply the similar fix to PSP
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Since this problem is the same here

(cherry picked from commit c080cc8068)
2026-02-06 09:10:59 -08:00
Wohlstand a2a4c2d439 SDL_render_vita_gxm.c: Fixed the black screen due to zero cliprect
#14645

(cherry picked from commit 2956d55797)
2026-02-06 09:10:59 -08:00
Wohlstand d2995655d5 SDL2: PSP: Fixed render-to-texture larger than screen
I found if I try to make texture bigger than screen and use it as a frame buffer, it gets cuts of content. To ensure that render will be valid, I making sure scissors were initialised properly.

P.S. This works on hardware, however, emulator PPSSPP seems has a bug in this case, so I going to report that and making the simple demo.

(cherry picked from commit 39a0fab4d7)
2026-02-06 09:10:49 -08:00
Wohlstand fe834123fd SDL_render_psp.c: Implemented working viewport support
Since it's no known way to use genuine viewport with PSP SDK, I implemented the workaround using manually added/subtracted offsets to vertices passing to the render API. To assign viewport and cliprect in valid way, I copied part of code from the Vita's module and adjusted it to work on PSP.

(cherry picked from commit 67141e5079)
2026-02-06 09:10:41 -08:00
Ozkan Sezer ec113c1f82 SDL_cocoawindow.m: fix what seems to be a typo in commit 649c36c5:
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
NSWindowCollectionBehaviorNone -> NSWindowCollectionBehaviorFullScreenNone

(cherry picked from commit b1d95b9d20)
2026-02-06 06:05:02 +03:00
Ryan C. Gordon 8306d559b9 cocoa: Fix SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES=0.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This hint is documented to not just turn off fullscreen windows going into a
new Fullscreen Space, but also to make the green button on a resizeable
window's title bar do a maximize/zoom instead of make the window fullscreen.

Previously, this only did the former and not the latter (or perhaps it worked
and the defaults changed in a newer macOS, we aren't sure).

Fixes #7470.

(cherry picked from commit 50f3adec77)
(cherry picked from commit 649c36c576)
2026-02-05 18:55:21 -05:00
Henrique Jorge Barateli e3048a9637 Fixed PS2 joystick analog sticks not enabled
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 99eca2ca0d)
2026-01-30 12:19:04 -08:00
Ozkan Sezer 7c79649244 SDL_bsdjoystick: fix OpenBSD build error due to -Wundef
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 07274fea58)
2026-01-30 01:21:10 +03:00
Brad Smith ba6b629a46 cmake: Fix header detection with CheckUSBHID
Make use of check_include_files to be able to also include
stdint.h when checking for the headers. Fixes detection of
usbhid.h on OpenBSD.

/usr/include/usbhid.h:40:2: error: unknown type name 'uint32_t'
   40 |         uint32_t _usage_page;
      |         ^

(cherry picked from commit 410a35fbee)
(cherry picked from commit 0c7042477a)
2026-01-28 07:46:32 -08:00
Wolf3s 143528c82a Fix the video size matching the renderer.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit f383330cfa)
2026-01-19 10:13:13 -08:00
Brad Smith 23073ee6ec autotools: Replace sys/types.h usage with stdint.h with CheckUSBHID
(cherry picked from commit de41387c4b)
2026-01-19 08:30:44 -08:00
Sam Lantinga 522ff67cc8 Updated copyright for 2026
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
2026-01-01 09:56:59 -08:00
Petar Popovic ed92b6c79b Fix uninitialized variable warning when compiling tests with clang compiler
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 38e0094637)
2025-12-29 23:40:50 +03:00
Simon McVittie e8aa9551cb test: Don't expect a specific error message
SDL3 + sdl2-compat doesn't give precisely the same error message as
"classic" SDL2 here. To facilitate the transition from "classic" SDL2
to sdl2-compat, allow either one. This allows the "classic" SDL2 test
suite to be run against sdl2-compat, demonstrating that sdl2-compat is
indeed compatible with the version that it's replacing.

Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit c795b08567)
2025-12-29 10:05:54 -08:00
Sam Lantinga 95ba5679ef Added a Linux mapping for the Nacon GC100 controller (thanks @elkabyliano!)
(cherry picked from commit d10fe8bf2f)
(cherry picked from commit 13db7f049a)
2025-12-29 09:47:50 -08:00
Peppersawce f21394381b Make BUrl not 'ambiguous'
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit bacfd3c252)
2025-12-10 08:32:55 -08:00
PulkoMandy 843345a18c Use a BHandler attached to the application instead of a BLooper
When there is already a BApplication, SDL cannot start its own. In a
previous version, it instead started a separate looper. This results in
some extra complexity as there is now yet another thread to manage (in
addition to the main thread, the application thread, and the window
threads).

Instead, create a BHandler and attach it to the existing BApplication,
which allows it to receive messages in the already existing application
thread.

(cherry picked from commit 47312cf0f3)
2025-12-10 08:32:55 -08:00
Sam Lantinga 4478ad67d2 Lock joysticks when they are connected/disconnected on emscripten
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes https://github.com/libsdl-org/SDL/issues/11499

(cherry picked from commit 0281071243)
(cherry picked from commit d9836d15e7)
2025-12-08 21:01:47 -08:00
Cameron Gutman 667e4e9020 egl: Fix X11 EGL window creation on Nvidia
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
This is a port of 808a3f5 to SDL2.

Fixes #13094

(cherry picked from commit 3146374e4a)
2025-12-05 23:20:45 -06:00