15965 Commits

Author SHA1 Message Date
Hunter Kvalevog
14f7eebac6 testcamera: Add [--camera name] parameter 2024-06-04 16:24:27 -07:00
Wouter Wijsman
a3adc41f79 PSP: Add on-screen keyboard support 2024-06-04 14:31:05 -07:00
Wouter Wijsman
25e41df4db
Merge pull request #9961 from erysdren/psp-renderer-crash
SDL_render_psp.c: Fix crash in PSP_DestroyRenderer()
2024-06-04 23:27:57 +02:00
Sam Lantinga
4d392bfc67 Fixed camera capture on iOS
My phone captured 1920x1080 images even though the highest reported format was higher resolution, so I adjusted testcamera to be able to handle different sized images than expected.

Fixes https://github.com/libsdl-org/SDL/issues/9930
2024-06-04 11:34:39 -07:00
Sam Lantinga
7e231fcd90 Added testcamera to Xcode test apps 2024-06-04 10:43:45 -07:00
Sam Lantinga
b1529699cf Fixed Xcode build after adding offscreen Vulkan support 2024-06-04 10:43:20 -07:00
Sam Lantinga
60396971ce Move the main header with SDL_MAIN_USE_CALLBACKS 2024-06-04 10:42:44 -07:00
David Gow
5eeeaf4780 render: Mark an already-destroyed renderer as freed
It's possible to destroy an SDL_Renderer without freeing it using
SDL_DestroyRendererWithoutFreeing(), which is used to make it possible
to destroy windows and their renderers in either order. However, if a
renderer has already been destroyed before it is freed (e.g., the window
was destroyed before the renderer), the object is never marked invalid.
This means the SDL_Renderer is reported as leaked, even if
SDL_DestroyRenderer() is called.

SDL_GetWindowSurface() will trigger this, as the window texture is
cleaned up _after_ the window destroys its associated renderer. This
makes it impossible to use SDL_FRAMEBUFFER_ACCELERATION without
triggering a leak warning.

Fix this by unconditionally marking the SDL_Renderer object as invalid
in SDL_DestroyRenderer().
2024-06-04 07:50:46 -07:00
Mathieu Eyraud
43c2b42517 Fix stack address escape in SDL_CameraDevicePermissionOutcome()
If allocation of 'p' fails, 'pending_tail' points to 'pending'.
2024-06-04 07:49:07 -07:00
Mathieu Eyraud
c226630086 Fix memory leak in SDL_IOFromFile()
If Android_JNI_FileOpen() or windows_file_open() fail, SDL_CloseIO(iostr) does nothing because 'iostr' is NULL and 'iodata' is leaked.
2024-06-04 07:48:25 -07:00
Sam Lantinga
470cfc2755 Make sure we set the initial report interval value 2024-06-04 07:47:34 -07:00
meyraud705
4c9a91b62e Update gamepad sensor rate
SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL allows to change sensor rate. Make SDL_GetGamepadSensorDataRate() returns the updated value.
2024-06-04 07:38:48 -07:00
SDL Wiki Bot
e5101ebae6 Sync SDL3 wiki -> header 2024-06-04 04:11:34 +00:00
Sam Lantinga
a0d1445ccb Replaced SDL_GetRendererInfo() with SDL_GetRendererName()
The texture formats are available via the SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER property

Fixes https://github.com/libsdl-org/SDL/issues/9851
2024-06-03 21:10:58 -07:00
Ozkan Sezer
ca28bcb3b8 hidapi/windows/hid.c: avoid warnings with gcc < 8. 2024-06-04 06:10:24 +03:00
SDL Wiki Bot
74c9c9a325 Sync SDL3 wiki -> header 2024-06-04 01:23:30 +00:00
Semphris
8c8ee2174d Dialog: Add filter number, remove NULL termination 2024-06-03 18:22:26 -07:00
Sam Lantinga
3e70964ae2 Updated docs to note that SDL_GetAudioDeviceName() now returns const char * 2024-06-03 17:42:53 -07:00
Sam Lantinga
1d83b782b8 Set the headphones to 50% volume to avoid blasting people's ears
Also fixed audio routing comments
2024-06-03 17:28:32 -07:00
Sam Lantinga
8aa7910184 Added an example of setting PS5 controller audio routing
Closes https://github.com/libsdl-org/SDL/pull/9661
2024-06-03 17:24:36 -07:00
erysdren
b867db4d54 SDL_render_psp.c: Fix crash in PSP_DestroyRenderer() 2024-06-03 17:33:51 -05:00
Sam Lantinga
a9a51cebde Disable raw keyboard input by default
It interferes with keyboard hooks and most applications don't expect key events coming from another thread
2024-06-03 14:43:46 -07:00
Sam Lantinga
73879ef26e Only register for the type of raw input requested by the application 2024-06-03 14:43:46 -07:00
Anonymous Maarten
a919774fe4
Build with -Wfloat-conversion + fix all warnings 2024-06-03 21:33:29 +00:00
SDL Wiki Bot
17c459e384 Sync SDL3 wiki -> header 2024-06-03 18:48:59 +00:00
SDL Wiki Bot
9c4fb449e2 Sync SDL3 wiki -> header 2024-06-03 18:41:23 +00:00
SDL Wiki Bot
de5a8b61d0 Sync SDL3 wiki -> header 2024-06-03 18:27:57 +00:00
SDL Wiki Bot
39c2dacc8f Sync SDL3 wiki -> header 2024-06-03 18:21:49 +00:00
Ryan C. Gordon
e23257307e Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.

This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.

Fixes #9902.

(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
Carlo Bramini
b1f3682216 SDL_assert: add support for aarch64-w64-mingw32
GCC 15 development branch provides an experimental support for Windows on ARM64, which will be officially released next year, according to latest news.
I tried to compile SDL2 with this new compiler but I got a tiny problem into SDL_assert.h because it couldn't find the right platform.
However, it has been easy to fix and I included it into this PR.
More details can be also found here:
https://learn.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-170

(cherry picked from commit 2cb1a2d0a7f1c9cb3177c907758322899c3041d5)
2024-06-03 10:55:14 -07:00
Sam Lantinga
76e5aa5bfd Log any leaked objects at shutdown 2024-06-03 08:54:46 -07:00
Sam Lantinga
b0e93e4e63 Prevent crashes if freed objects are passed to SDL API functions
Instead of using the magic tag in the object, we'll actually keep track of valid objects

Fixes https://github.com/libsdl-org/SDL/issues/9869
Fixes https://github.com/libsdl-org/SDL/issues/9235
2024-06-03 08:54:46 -07:00
Ryan C. Gordon
57a15933cd SDL_GetCSSCursorName: Don't assert on unrecognized cursor types.
These values are passed through from the calling app and shouldn't trigger
asserts when they are bogus.
2024-06-01 22:32:43 -04:00
Ryan C. Gordon
9a9a3d1a33 SDL_SystemCursor: rename enum items to match CSS.
Fixes #9079.
2024-06-01 22:32:43 -04:00
Ozkan Sezer
49b6c24722 always define PRI?64 using 'I64' when targeting windows
avoids -Wformat warnings from mingw toolchains -- e.g.:
src/test/SDL_test_harness.c:581:37: warning: unknown conversion type character 'l' in format [-Wformat=]
2024-06-01 22:35:40 +03:00
Anonymous Maarten
fd2b9c0602 cmake: don't check c++ compiler flags for asan when CXX is not enabled 2024-06-01 10:18:15 +02:00
Frank Praznik
85a2a201b1
x11: Always disable the borders when leaving fullscreen from a borderless window created as fullscreen
Borderless windows flagged as fullscreen at creation time turn on the borders, because doing so prevents some window managers from wrongly positioning the borderless window, and in these cases the borders need to be removed whether fullscreen is exited programmatically or via a compositor event. Set a flag when forcing the borders on, so they will be removed in all cases later.
2024-05-31 19:11:50 -04:00
Sam Lantinga
4c7459eda8 SDL_cocoawindow: Fix setting parent-relative coordinates for child windows in Cocoa_SetWindowSize 2024-05-31 15:29:19 -07:00
Sam Lantinga
e3beaa1972 Added support for the Razer Kitsune in PS5 mode 2024-05-31 15:18:15 -07:00
Sam Lantinga
cd9c25e800 Don't set the borderless flag if we're about to go fullscreen.
This prevents the GNOME window manager from moving the window to a different display before the window goes fullscreen.

Fixes https://github.com/libsdl-org/SDL/issues/9915
2024-05-31 11:35:18 -07:00
Anonymous Maarten
6896c4c3bf tests: testcases accept a void pointer argument 2024-05-31 19:18:24 +02:00
Anonymous Maarten
d5060423a2 testplatform: fix leak at exit time
A leak was present at exit time on the Emscripten platform
2024-05-31 18:53:36 +02:00
Anonymous Maarten
4b0f52b04e cmake: fall back to per-cpu test when all-in-one test fails
The 'all-in-one' test fails for Emscripten because try_compile does not copy back the actual binary:
the wasm file contains the machine parseable strings, not the html or js file(s).
2024-05-31 18:53:21 +02:00
mechakotik
8f88c32ca6 android: Default to custom theme in styles.xml
Custom theme file exists in project, but is not used by app, which is kinda unintuitive. Using it by default so people who not familiar with Android development won't spend lots of time troubleshooting.
2024-05-31 09:04:06 -07:00
Ozkan Sezer
550d5b95c0 fix type redefinition errors after commit b1b4638cacbe. 2024-05-31 17:47:20 +03:00
Ozkan Sezer
5aa9ee8446 SDL_windowsmodes.c (WIN_GetDisplayNameVista): fix return after PR/9923
why haven't any of the build tests catch this..
2024-05-31 11:33:50 +03:00
Sam Lantinga
90beffdeb1 Revert "WASAPI_WaitDevice: Check current padding before waiting on event"
This reverts commit 09fbb2a07dfca7f3daf4f9c24d5bc0c8ee62cfce.

This was causing issues in CS2 and DOTA:
https://old.reddit.com/r/DotA2/comments/1d4bqe3/dota_2_sound_crackling_since_this_morning/
https://old.reddit.com/r/DotA2/comments/1d44udf/anyone_having_sound_issues_or_any_clue_how_to_fix/
2024-05-30 16:50:30 -07:00
Ozkan Sezer
e4518af377 move vista+ display config function ptr calls to device->driverdata
.. and change hdr code's display config function calls to use those
function ptrs.
2024-05-31 02:50:02 +03:00
Sam Lantinga
fb2287dd47 Fixed updating NV12 and YV12 textures on the direct3d11 renderer
Fixes https://github.com/libsdl-org/SDL/issues/9928
2024-05-30 14:19:34 -07:00
Hunter Kvalevog
8604847214 SDL_SetEventFilter: Don't flush when removing filter
Don't flush the event queue if the filter paramter is NULL.
2024-05-30 13:06:01 -07:00