Commit Graph

1552 Commits

Author SHA1 Message Date
Sam Lantinga
795499a529 Removing a timer that isn't running is a success. 2024-08-04 20:00:13 -07:00
Sam Lantinga
ef6521aee7 testnative: print events with --info event 2024-08-04 09:07:19 -07:00
Sam Lantinga
490f7af92b Removed test that triggers an asan overflow warning
Fixes https://github.com/libsdl-org/SDL/issues/8884
2024-08-03 18:20:26 -07:00
Sam Lantinga
f7c8d66ccb Use the convenience function SDL_GetWindowFromEvent() 2024-08-02 20:36:35 -07:00
Anonymous Maarten
f57c597c60 Added SDL_GetWindowFromEvent 2024-08-03 02:37:11 +00:00
Sam Lantinga
50492e1d03 Change the text input defaults to match the natural input experience 2024-08-02 14:49:37 -07:00
Sam Lantinga
81f8e6aba6 Added SDL_StartTextInputWithProperties()
This allows you to customize the text input so you can have numeric text entry, hidden passwords, etc.

Fixes https://github.com/libsdl-org/SDL/issues/7101
Fixes https://github.com/libsdl-org/SDL/issues/7965
Fixes https://github.com/libsdl-org/SDL/issues/9439
2024-08-02 14:49:37 -07:00
Sam Lantinga
5d51e3b4ab testime: added support for multiple windows 2024-08-02 14:49:37 -07:00
Sam Lantinga
31ed3665ad Added support for high-DPI cursors and icons
Fixes https://github.com/libsdl-org/SDL/issues/9838
2024-08-01 13:48:28 -07:00
Sam Lantinga
a5f18048b2 Extend the 9-grid functions to handle a non-uniform grid layout (thanks @zaun!)
Fixes https://github.com/libsdl-org/SDL/issues/10389
2024-07-31 22:36:39 -07:00
Anonymous Maarten
a1c6f99877 android: add script in Android archive to create a SDK
Also,
- Move mingw's pkg-support into build-scripts
- Add type annotations to python scripts for mypy
- ci: use v4 tag of actions/cache
- cmake: use PYTHON3_EXECUTABLE for running xxd.py
  (Python3::Interpreter is not always recognized.)
2024-08-01 05:07:08 +02:00
Sam Lantinga
091960441b Don't check SDL_RENDER_DRIVER in automated tests
This might be set in the environment for testing purposes
2024-07-31 19:10:13 -07:00
Anonymous Maarten
b68ac011e0 ctest: fail if there are outstanding allocations 2024-07-30 20:56:19 +00:00
Sam Lantinga
dfe6efcd2d Fixed memory leak in testthread 2024-07-28 08:05:31 -07:00
Sam Lantinga
728bf363cb Make sure we call SDL_Quit() before SDLTest_CommonDestroyState()
Otherwise we'll report leaks that will be cleaned up in SDL_Quit()
2024-07-28 08:05:31 -07:00
Sam Lantinga
1d5f9c7b92 testaudio: fixed memory leak in SetTitleBar() 2024-07-27 09:16:29 -07:00
Sam Lantinga
473feab2a4 Added SDL_unsetenv() 2024-07-27 09:10:08 -07:00
Sam Lantinga
b854e1fe0b Fixed some issues found with static analysis 2024-07-27 09:07:42 -07:00
Sam Lantinga
623a90c47d testutils: use SDL_asprintf() to simplify path composition 2024-07-27 08:41:06 -07:00
Anonymous Maarten
3bfc103e76 tests: start memory tracking first + clean up cached text textures 2024-07-27 13:44:04 +02:00
Anonymous Maarten
6f1136c6ce testgles2: fix leaks 2024-07-27 13:06:54 +02:00
Sam Lantinga
4f55271571 Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.

So, we're largely going back to the original system, where the API returns allocated results and you free them.

In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
Sam Lantinga
5e513ecc7f Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.

Fixes https://github.com/libsdl-org/SDL/issues/10378
2024-07-26 10:05:03 -07:00
Frank Praznik
66eb2ea443 mouse: Make pointer warp emulation via relative mode available to all platforms
Move the Wayland pointer warp emulation code up to the SDL mouse layer, and activate it when a client attempts to warp a hidden mouse cursor when the hint is set.

testrelative adds the ability to test the warp emulation activation/deactivation with the --warp parameter and 'c' key for toggling cursor visibility.
2024-07-25 19:57:39 -04:00
Sam Lantinga
cf8b158ccb Added SDL_GetRenderSafeArea() 2024-07-24 17:40:41 -07:00
Sam Lantinga
a7c0192017 Renamed SDL_PostSemaphore() to SDL_SignalSemphore() 2024-07-24 13:37:40 -07:00
Sam Lantinga
b499c54af4 Fixed testvulkan on macOS (thanks @proton991!)
Fixes https://github.com/libsdl-org/SDL/issues/10351
2024-07-23 08:17:22 -07:00
Sam Lantinga
29f0fd33dc SDL_getenv() should return const
This also allows us to use SDL_FreeLater() and make SDL_getenv() thread-safe on Windows.
2024-07-22 13:00:39 -07:00
Sam Lantinga
ef21e31a9a SDL_GUIDFromString() renamed SDL_StringToGUID() 2024-07-22 12:39:15 -07:00
Sam Lantinga
ff1d351390 Removed SDL_FreeTemporaryMemory()
This was just causing confusion and anxiety. SDL temporary memory will be automatically freed on the main thread when processing events and on other threads when it ages out after a second. The application can free it directly by calling SDL_ClaimTemporaryMemory() to get ownership of the pointer, if necessary.
2024-07-22 07:34:25 -07:00
Sam Lantinga
033c9c5951 Added SDL_CopyFile() and SDL_CopyStorageFile()
Fixes https://github.com/libsdl-org/SDL/issues/9553
2024-07-21 19:58:23 -07:00
Sam Lantinga
bd27b89903 Prevent potential overflow in rectangle functions
We're limiting the functions to rects with positions and sizes < 1 billion for speed, which is totally fine for most SDL use cases. If you need rectangles larger than that, you can roll your own functions that use 64-bit intermediate values and do proper overflow handling of output values.

Fixes https://github.com/libsdl-org/SDL/issues/8879
2024-07-21 13:04:11 -07:00
Sam Lantinga
4830fc4e40 Added more 8-bit blit test coverage 2024-07-21 11:39:38 -07:00
Sam Lantinga
bab982f2e0 Don't recalculate the blit mapping when changing surfaces
We don't actually need to change the blit mapping if we're targeting a new surface with the same format and palette.
2024-07-21 11:39:38 -07:00
Sam Lantinga
e0fd59de64 Fixed floating point rectangles to be mathematically correct.
* A floating point rectangle contains all points >= x and <= x + w
* A floating point rectangle is only empty if it has negative width. The zero rectangle contains the zero point.
* Adjacent floating point rectangles intersect along their shared side

Fixes https://github.com/libsdl-org/SDL/issues/6791
2024-07-21 08:08:15 -07:00
Sam Lantinga
9e978740c3 Removed unnecessary casts 2024-07-21 08:08:15 -07:00
Sam Lantinga
35ae56d344 Switched the rectangle tests to listing by name instead of by number. 2024-07-21 08:08:15 -07:00
Sam Lantinga
6209c71f54 Added SDL_BlitSurface9Grid() and SDL_RenderTexture9Grid() 2024-07-20 18:21:19 -07:00
Sam Lantinga
198caa54a1 Added SDL_RenderTextureTiled() 2024-07-20 18:21:19 -07:00
Sam Lantinga
9e55ee9391 Added SDL_BlitSurfaceTiledWithScale() 2024-07-20 18:21:19 -07:00
Sam Lantinga
f47ddbf1ac Added SDL_BlitSurfaceTiled()
Fixes https://gamedev.stackexchange.com/questions/136792/is-there-a-way-to-set-texture-wrap-mode-as-repeat-in-sdl-2
2024-07-20 18:21:19 -07:00
Sam Lantinga
03bb2c17ed Enable texture wrapping for SDL_RenderGeometry()
Currently wrapping is based on whether texture coordinates are outside of [0,1], but the code is structured so it's easy to add an API to set it and add additional wrapping modes if we want.

Fixes https://github.com/libsdl-org/SDL/issues/9238
Closes https://github.com/libsdl-org/SDL/pull/5369
2024-07-20 09:51:05 -07:00
Sam Lantinga
a340de6196 The candidates in SDL_EVENT_TEXT_EDITING_CANDIDATES should be a single allocation 2024-07-19 12:22:03 -07:00
Sam Lantinga
fd9fe1bb7b Renamed event memory to temporary memory, since it's not just used for events 2024-07-19 12:22:03 -07:00
Sam Lantinga
c4eac60000 SDL_GetClipboardData() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
61a7a0e579 SDL_GUIDToString() follows the SDL_GetStringRule
Also removed the distinction between SDL_GUID and SDL_JoystickGUID
2024-07-19 12:22:03 -07:00
Sam Lantinga
856d598d6e SDL_GetSensors() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
4f8c348402 SDL_GetPreferredLocales() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
9be73ed7c5 SDL_GetMice() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
6ca18ed0e5 SDL_GetKeyboards() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00