Commit Graph

1805 Commits

Author SHA1 Message Date
Anonymous Maarten
b713e7581b stdlib: fix SDL_strtol of "0" with base 0
SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
2025-01-02 01:15:28 +01:00
Sam Lantinga
e43aa12b49 Updated copyright for 2025 2025-01-01 08:01:29 -08:00
Sam Lantinga
f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Sam Lantinga
3197e27b59 testcamera: fixed return codes 2024-12-31 19:27:11 -08:00
Sam Lantinga
f18e023317 Added testclipboard 2024-12-31 19:27:11 -08:00
Sam Lantinga
1c04ebe423 Renamed SDL_ASYNCIO_CANCELLED to SDL_ASYNCIO_CANCELED 2024-12-30 19:13:02 -08:00
Anonymous Maarten
543f244965 tests: include SDL_build_config.h when HAVE_BUILD_CONFIG is defined 2024-12-29 20:08:06 +01:00
Ozkan Sezer
c2121dd9a2 testcamera: fix MSVC build failure due to C4244 warning. 2024-12-29 21:28:02 +03:00
Sam Lantinga
5c84d38822 testcamera: don't pick a frame size larger than the maximum texture size
Ran into this on a Huawei Y6 phone, where the back facing camera can generate 4160x2000 frames, but the maximum texture size was 4096x4096
2024-12-29 09:41:00 -08:00
Anonymous Maarten
f1232de3d2 cmake: add_dependencies must have at least 2 arguments 2024-12-28 02:43:12 +01:00
Anonymous Maarten
2664d36faf cmake: avoid parallel generation of headers through intermediate target
See
https://cmake.org/cmake/help/latest/command/add_custom_command.html#example-generating-files-for-multiple-targets
2024-12-28 02:39:12 +01:00
Sam Lantinga
75a24116b5 testcontroller: show gamepad connection state 2024-12-27 13:58:49 -08:00
Semphris
0461180e25 SDL_EVENT_QUIT when no window nor tray
SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE will not fire if there are active tray icons. This impacts only applications that create tray icons, and that at least one icon outlives the last visible top-level window. SDL_EVENT_QUIT will fire when the last active tray is destroyed if there are no active windows.
2024-12-27 09:22:27 -08:00
Sam Lantinga
948b16533c testcamera: use the first available cameras 2024-12-26 19:23:43 -08:00
Semphriss
01b9b0edb7 Add system tray support (#10873) 2024-12-24 10:36:39 -08:00
capehill
80c1b1e1a0 Fix testautomation pixels_saveLoadBMP big endian issue
It seems created surfaces are ARGB8888 format on both BE and LE,
therefore BGRA32 failed.
2024-12-22 12:08:54 -08:00
Sam Lantinga
cadeec9cc9 SDL_SoftStretch() doesn't handle large pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/11534
2024-12-21 09:19:03 -08:00
Sam Lantinga
f37eef948c Removed raw mouse events
It's too close the 3.2.0 release for an API change like this.

If/when we re-add these, some things for consideration:
* What use cases does this enable that aren't currently possible?
* What cross-platform API guarantees do we make about the availability of these events? e.g. do we try to simulate them where raw input isn't actually available?
* How is this different from the existing relative mode, and how do we clearly explain when you want these events vs wanting relative mode?

Notes from @expikr:
First observation: the reason I originally passed denominators instead of multipliers was because some rational values cannot be exactly represented by floats (e.g 1/120) so instead let the end-developer decide how to do the dividing themselves. It was the reason why it was using split values with an integer numerator to begin with, instead of having both as floats or even just normalize it in advance.

On the other hand, passing them as multipliers might have hypothetical uses for dynamically passing end-user controlled scaling in a transparent manner without coupling? (Though in that case why not just do that as additional fields appended to `motion` structs in an API-compatible layout?)

So it’s somewhat of a philosophical judgement of what this API of optional availability do we intend for it to present itself as:
- should it be a bit-perfect escape hatch with the absolute minimally-denominal abstraction over platform details just enough to be able to serve the full information (á la HIDPIAPI),
- or a renewed ergonomic API for splitting relative motion from cursor motion (in light of The Great Warping Purge) so that it is unburdened by legacy RelativeMode state machines, in which case it would be more appropriate to just call it `RELATIVE` instead of `RAW` and should be added alongside another new event purely for cursor events?

This alternate API stream was conceived in the context of preserving compatibility of the existing RelativeMode state machine by adding an escape hatch. So given the same context, my taste leans towards the former designation.

However, as The Great Warping Purge has made it potentially viable to do so, if I were allowed to break ABI by nuking the RelativeMode state machine entirely, I would prefer the latter designation unified as one of three separate components split from the old state machine, each independently controlled by platform-dependent availability without any state switching of a leaky melting pot:
- cursor visibility controls (if platform has cursor)
- cursor motion events (if platform has cursor)
- relative motion events (if the platform reports hardware motion)
2024-12-21 05:18:42 -08:00
Sam Lantinga
c44fa5bb07 Updated raw input events to match SDL style
Also added raw keyboard events, and implemented raw input events on iOS, OpenBSD console, Linux console, and X11
2024-12-21 05:18:42 -08:00
Frank Praznik
5ec5f23fff tests: Print accurate enabled/disabled relative mode status in testrelative 2024-12-20 10:57:12 -05:00
cosmonaut
0f9e86fe1c tests: Fix GPU tests crashing when window is minimized 2024-12-19 16:21:50 -08:00
cosmonaut
e46d8756e5 tests: Update GPU tests to use new swapchain best practice 2024-12-19 15:55:04 -08:00
Frank Praznik
4bfc8f84f7 tests: Add a raw event mode to testrelative
Add a code path to test raw motion events (activated by '--raw').
2024-12-19 14:14:36 -05:00
Sam Lantinga
e08f34c3be Removed SDL_HINT_MOUSE_RELATIVE_MODE_WARP
This complicated mouse handling and is a rarely tested path. Real relative mode is much better performance and higher precision.
2024-12-19 10:33:02 -08:00
Frank Praznik
eda0261c4e video: Drop size and position requests for windows in a fixed size/position state
It is not uncommon for clients to redundantly set the window size and position, either as a holdover from an SDL 1 port, when this was required, due to any window state change triggering a universal update function that sets all window state, even if unnecessary (e.g. always calling SDL_SetWindowSize(), even if the window is fullscreen), or due to the use of compatability layers. Historically, these clients expect that their behavior won't override the base window state, which is an assumption that the windowing changes in SDL 3 broke by caching size and position changes that can't be applied immediately.

This change drops size and position requests when the window is in the maximized and fullscreen states (fullscreen-desktop windows will be repositioned, but the non-fullscreen floating position will not be overwritten), which is behavior more in line with existing client assumptions, and should ease the porting process, as well as prevent annoying bugs when older software is run via sdl2-compat.

In the process of making these changes, pending window state has been moved to separate variables in the SDL_Window struct, as this fixes bugs regarding fullscreen display selection and centering windows immediately after resize on asynchronous platforms, which had issues due to pending state possibly being overwritten.
2024-12-17 10:45:40 -05:00
Ryan C. Gordon
1fbb8e1824 examples/audio/04-multiple-streams: Remove drag-and-drop support.
I'm going to reuse that code for an actual drag/drop example later, but for
simplicity and accessibility of the examples, this is just going to load two
wavs and loop them, so you get the music with a sword-clinking sound mixed
over it.
2024-12-10 23:10:43 -05:00
Sam Lantinga
900627f7fc Enable the SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS hints on macOS
Fixes https://github.com/libsdl-org/SDL/issues/4000
2024-12-06 17:07:16 -08:00
Sam Lantinga
23828b62d4 Added SDL_IsMainThread() and SDL_RunOnMainThread() 2024-12-05 13:53:51 -08:00
Ryan C. Gordon
3ca629ceb5 asyncio: Allow file closes to request a flush/fsyncdata. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon
e79ce2a200 asyncio: Added async i/o APIs. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon
f852038384 filesystem: Added SDL_GetCurrentDirectory().
Fixes #11531.
2024-11-27 23:42:11 -05:00
Sam Lantinga
e027b85cc4 Validate that pixel formats have the correct attributes
Also added a test to save and load as BMP format to make sure pixel transformations are working correctly.

Fixes https://github.com/libsdl-org/SDL/issues/11483
2024-11-17 11:58:57 -08:00
Ryan C. Gordon
e4778d53d3 testautomation_video: Another Emscripten test to be skipped. 2024-11-14 19:34:25 -05:00
Ryan C. Gordon
d48d4c8c48 testautomation_video: Don't test window position on Emscripten.
This _might_ fix GitHub Actions. We'll know once I push this!  :)
2024-11-14 19:00:10 -05:00
cosmonaut
a85f0b49f4 GPU: Remove D3D11 shaders from testgpu_spinning_cube 2024-11-12 17:32:25 -08:00
L zard
1ed1bc1d5d testautomation keyboard: use space instead of a 2024-11-08 07:01:50 -08:00
capehill
588e32ea5a test: Change LoadContext() return value type from int to bool
It should be then consistent with SDL_SetError().
2024-11-05 14:22:57 -08:00
Sam Lantinga
ecfd143a26 testcontroller: update the controller name when it's opened as a gamepad 2024-11-05 11:43:28 -08:00
Sam Lantinga
0ef7a1d901 Show the guid of gamepads that are opened 2024-11-05 11:43:28 -08:00
Wouter Wijsman
780578cd36 PSP: Allow building tests in parallel 2024-11-01 08:57:09 -04:00
Sam Lantinga
77a0411dde Minor cleanup 2024-10-31 15:44:41 -07:00
Sam Lantinga
850158f83f testcontroller: fixed incorrect usage of memcpy() 2024-10-24 18:12:01 -07:00
Sam Lantinga
370c0426ce testspriteminimal: only quit when escape is pressed 2024-10-23 10:51:14 -07:00
Sam Lantinga
45584ad73e Simplify get_channel_name() so it's easier for people to read and understand 2024-10-22 18:19:30 -07:00
Sam Lantinga
315842cf71 Fixed crashes handling D3D11/12 device lost in testsprite
You can test this using "dxcap -forcetdr"
2024-10-21 00:29:18 -07:00
Petar Popovic
6897385623 Add void to run_colorspace_test() function prototype 2024-10-16 11:16:42 -07:00
Sam Lantinga
afee27a530 Make sure stdio handles are in blocking mode
Standard I/O doesn't work well with non-blocking handles, so make sure any pipes are in blocking mode before launching child processes.

Fixes https://github.com/libsdl-org/SDL/issues/10998
2024-10-14 22:10:49 -07:00
Sam Lantinga
bb764e3106 Added support for full range BT.709 YUV conversion
Also added simple colorspace testing to testyuv.
2024-10-14 20:36:46 -07:00
Zack Middleton
f212cb5f92 Don't overwrite the SDL_IOFromConstMem() error in testshape 2024-10-14 20:07:03 -07:00
Ryan C. Gordon
44bc19b592 test: remove testaudio-art.txt (this info is in test/LICENSE.txt now). 2024-10-14 01:52:18 -04:00