Commit Graph

1332 Commits

Author SHA1 Message Date
Frank Praznik f4aca6866c test: Free clipboard data after calling SDL_GetClipboardText()
Clipboard allocations were being leaked in two instances.
2024-05-13 10:27:24 -04:00
Sam Lantinga c95c415a0b Fixed warning C4244: '=': conversion from 'SDL_Keymod' to 'Uint16', possible loss of data 2024-05-10 16:43:09 -07:00
Sam Lantinga c1ba31118b Added ball, touchpad, and sensor support for virtual joysticks
Fixes https://github.com/libsdl-org/SDL/issues/9542
2024-05-09 18:25:22 -07:00
Sam Lantinga bcbf09acde Renamed SDL_AttachVirtualJoystickEx() to SDL_AttachVirtualJoystick()
The shorthand version of this function didn't allow specifying a controller name, which seems pretty important. It seems like anyone actually implementing a virtual joystick is going to want to use some of the extended functionality.
2024-05-09 14:05:58 -07:00
Sam Lantinga 54fb629da5 SDL_WindowFlags is now 64-bit
Fixes https://github.com/libsdl-org/SDL/issues/7321
2024-05-09 10:39:54 -07:00
Frank Praznik 1f43c88220 time: Use a function instead of properties to retrieve the system date and time locale info
This allows applications to re-query the values if the system locale is changed during runtime, and better matches the other locale functions. A note is included in the documentation mentioning that this can be slow, as it has to call into OS functions.

Also allows for the removal of the init/quit time functions, as they are no longer needed.
2024-05-08 15:35:04 -04:00
Sam Lantinga aecb62e30d Improved API consistency for flag data types
Flag data types are always unsigned and have the valid values following the typedef.
2024-05-07 12:24:37 -07:00
Anonymous Maarten 9aff68746f cmake: add khronos include directories with PRIVATE visibility 2024-05-07 17:37:21 +02:00
Susko3 56feecc17d
Fix property cleanup callback not being called on error (#9663)
The documentation for `SDL_SetPropertyWithCleanup` mentions that the cleanup function
is called upon failure. But this wasn't working in the code.
2024-05-06 14:50:28 -07:00
Petar Popovic 45ac1a09d9 System dependent 64 bit integer suffixes
Added macros SDL_SINT64_C() and SDL_UINT64_C().
Integer suffixes of SDL_MAX_SINT64, SDL_MIN_SINT64, SDL_MAX_UINT64
and SDL_MIN_UINT64 are now system dependent.
2024-05-06 09:08:49 -07:00
Frank Praznik 3979ea8ed0 tests: Add a pointer warp test to testmouse
Press 'c' to center the pointer in the window using relative coordinates via SDL_WarpMouseInWindow().

Press alt+'c' to center the pointer in the window using global coordinates via SDL_WarpMouseGlobal().
2024-05-03 12:33:19 -04:00
Sam Lantinga 22016228ca Fixed build 2024-05-03 09:25:54 -07:00
Sam Lantinga db43a6b418 testcamera: open the camera using the highest framerate available 2024-05-02 12:27:20 -07:00
Sam Lantinga e6e1412e20 testcamera: create the texture as a streaming texture, since we'll update it every frame.
Also set the window size to the camera texture size
2024-05-02 11:40:28 -07:00
Semphris b9d3d746a0 Add trailing path separator to SDL_GetUserFolder() 2024-04-30 18:01:16 -07:00
Semphris c6a70d6898 Add support for modal windows to more platforms
- Adds support for modal windows to Win32, Mac, and Haiku, and enhances functionality on Wayland and X11, which previous set only the parent window, but not the modal state.
- Windows can be declared modal at creation time, and the modal state can be toggled at any time via SDL_SetWindowModalFor() (tested with UE5 through sdl2-compat).
- Allows dynamic unparenting/reparenting of windows.
- Includes a modal window test.
2024-04-30 13:47:57 -04:00
Sam Lantinga 0df12d223c Fixed crash cleaning up text
Text needs to be cleaned up before the renderer is freed.
2024-04-26 19:32:20 -07:00
Sam Lantinga 14f584a94b SDL_CreateWindowAndRenderer() takes the window title as the first parameter
Fixes https://github.com/libsdl-org/SDL/issues/9626
2024-04-25 20:00:14 -07:00
Petar Popovic e0b45fed06 testlock.c: replace function call kill with raise
Replacing function call `kill(0, SIGINT);` with `(void)raise(SIGINT);` in file test/testlock.c.
The `kill()` function is not available on Unix systems when compiling without system extensions enabled.
2024-04-25 15:11:08 -04:00
Frank Praznik 566d142938 tests: Clean up the renderer in the video test suite since it isn't automatic anymore. 2024-04-19 12:23:40 -04:00
Anonymous Maarten 911fc9b17e testffmpeg: treat Khronos headers as system headers 2024-04-18 09:10:15 -07:00
Sam Lantinga d51b53ef8f Add final Vulkan AV1 ext and VVC support
Fixes https://github.com/libsdl-org/SDL/issues/9464
2024-04-15 16:15:09 -07:00
Brick edaab8ad9f Refactored audio conversion to reduce copying
More of the logic has been moved into SDL_AudioQueue,
allowing data to be converted directly from the input buffer.
2024-04-15 11:47:18 -10:00
Brick ae57b0c9d8 Randomly split the data in audio_resampleLoss
This helps ensure correct resampling across track boundaries
2024-04-15 11:47:18 -10:00
Brick 8f6f9cadc4 Rewrote audio resampler using cubic filter interpolation
This allows using a much smaller (1.5 KB) lookup table, in exchange for a small amount of extra work per frame.

The extra work (a few extra loads/mul/adds) is negligible, and can execute in parallel.
The reduction in cache misses almost certainly outweighs any added cost.

The table is generated at runtime, and takes less than 0.02ms on my computer.
2024-04-15 11:47:18 -10:00
Brick f18cf7cffb Avoid changing dst_spec in testaudiostreamdynamicresample skip_audio
This is no longer allowed on bound streams
2024-04-15 11:47:18 -10:00
Sam Lantinga 43a59ffe45 Fixed crashes when a window has NULL driverdata 2024-04-15 10:15:10 -07:00
Cameron Cawley 723cbf4b8e testmouse: Create the window on the touch screen when building for the 3DS 2024-04-15 06:37:16 -10:00
Sylvain Becker 6b9a8f0da1 IOS: fix compilation of testautomation.app
only for IOS/TVOS, also disable testautomation_pen suite which requires sdl internals files
2024-04-15 03:28:16 -10:00
Petar Popovic edb370b8bb Fixing testffmpeg.c fallthrough warning 2024-04-15 03:27:42 -10:00
Semphris 0caa2828d5 Fixes for testdialog.c 2024-04-15 03:25:55 -10:00
Ryan C. Gordon d252a8fe12
joystick: SDL_VirtualJoystickDesc no longer takes a struct version.
If we need to extend this in the future, we'll make a second struct and
a second SDL_AttachVirtualJoystickEx-style function that uses it.

Just zero the struct and don't set a version.

Fixes #9489.
2024-04-13 14:16:12 -04:00
Ravbug 2d640d0b59
ci: Add iOS and tvOS CMake GitHub Actions checks (#9465)
- Also add watchos support to CMake (SDL does not support this platform yet)

Co-authored-by: Ravbug <ravbug@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-04-08 19:18:28 +02:00
Petar Popovic 764fe72449 SDL_time.h: Renaming enums SDL_DATE_FORMAT and SDL_TIME_FORMAT to SDL_DateFormat and SDL_TimeFormat 2024-04-07 23:03:01 -04:00
Sam Lantinga 5fa87e29e7 Removed SDL_RENDERER_ACCELERATED and SDL_RENDERER_SOFTWARE
These flags are unnecessary and have always been a source of confusion.
2024-04-04 13:30:49 -07:00
Ryan C. Gordon bc94451bed
testfilesystem: Add a '?' to the glob test, for a little more completeness. 2024-04-04 10:44:19 -04:00
Sam Lantinga 0abdc1a343 Renamed GLOBDIR to GLOB 2024-04-04 07:40:48 -07:00
Ryan C. Gordon 764207d873 filesystem: Added SDL_GlobDirectory() and SDL_GlobStorageDirectory().
Fixes #9287.
2024-04-04 09:40:13 -04:00
Sam Lantinga a82ed82bc7 SDL_QueryTexture() fills in a pointer to SDL_PixelFormatEnum 2024-04-01 15:45:22 -07:00
Sam Lantinga 8847b35244 Separate joystick power state into battery status and percentage
This allows you to see battery percentage while the controller is charging
2024-04-01 13:59:00 -07:00
Anonymous Maarten 72cf9c0ef4 test: don't run testautomation in parallel 2024-03-29 21:11:35 +01:00
Ryan C. Gordon 38e3c6a4aa
main: Add an optional `appstate` param to main callback entry points.
This allows apps to maintain state data without using global variables.

Fixes #9377.
2024-03-27 17:22:08 -04:00
Frank Praznik a7df28201b Revert "testautomation: fix renderer leak in video tests"
This reverts commit 2f13f66c71.

Not needed if renderers are once again implicitly cleaned up when their associated windows are destroyed.
2024-03-26 13:10:14 -07:00
Sam Lantinga f1f24b173c Added support for multiple distinct keyboards 2024-03-25 20:41:05 -07:00
Anonymous Maarten a65982e15d testevdev: include SDL_internal.h first, and fixup SDL_main.h 2024-03-26 00:10:40 +01:00
Cameron Gutman f14fb979c1 Remove legacy SDL2 input grab API 2024-03-24 16:53:23 -07:00
Christoph Reichenbach 0df0462d0a Removed all tabs in testautomation_pen.c 2024-03-24 05:05:30 -07:00
Christoph Reichenbach 615c7efd98 Fix #9279: Memory leak in pen name handling
- Fixes a leak in pen name allocation that would trigger
  for both X11 and Wayland for some non-pen input devices
  when new devices are added/removed.
- SDL_PenQuit() now deallocates and resets the table of known pens
- testautomation_pen.c now uses PenInit and PenQuit as setup and
  teardown, respectively

testautomation_pen.c was already triggering the leak, and it is
visible with --trackmem, so no new tests are added.
2024-03-24 05:04:53 -07:00
Anonymous Maarten 89b135e570 cmake: add automation and platform test without simd 2024-03-23 16:36:44 -07:00
Sam Lantinga 208cd434b5 Show the names of mice and keyboards when they connect 2024-03-23 16:31:00 -07:00