Commit Graph

14106 Commits (10a8b750a03b9c8af968b0be9a1b65ddcf0e79cc)

Author SHA1 Message Date
Sam Lantinga 04dfca958a Added a note to events indicating that memory is owned by SDL 2023-11-05 21:25:43 -08:00
Sam Lantinga 20cd789bab Improved migration documentation for the event memory change. 2023-11-05 21:20:48 -08:00
Anonymous Maarten 459f17257c cmake: fix MSVC unrecognized option link warning 2023-11-06 01:58:26 +01:00
Anonymous Maarten 761390b62f cmake: detect linker id, and assume MSVC does not support version scripts 2023-11-06 00:41:00 +01:00
Ozkan Sezer d2e005ee13 dynapi: remove duplicated SDL_LoadWAV entries 2023-11-05 20:32:50 +03:00
Frank Praznik 21ff699251 test: Fix popup test crash on exit
If the done signal is emitted by the common event handler, the window and all of its children have already been destroyed, so don't try to render with invalid renderer objects.
2023-11-05 12:29:22 -05:00
Sam Lantinga 70c149c88f Automatically clean up memory associated with events 2023-11-05 09:14:11 -08:00
Ozkan Sezer 1a83bf2399 fix a possible memory leak in SDL_vasprintf() 2023-11-05 20:01:02 +03:00
Jamie Madill 59b37d0e5b
cmake: fix Windows unrecognized option link warning
This fixes a warning that could show up on some MS linkers which use a
slightly different warning message than expected.

Amends check_linker_supports_version_file to include the "unrecognized
option" warning message.
2023-11-05 16:28:22 +00:00
Sam Lantinga 9302d7732d Fixed touch normalized coordinates
When converting normalized coordinates to pixel coordinates, the valid range is 0 to (width or height) - 1, and the pixel coordinate of width or height is past the edge of the window.

Fixes https://github.com/libsdl-org/SDL/issues/2913
2023-11-05 06:55:39 -08:00
SDL Wiki Bot ff3c20a799 Sync SDL3 wiki -> header 2023-11-05 14:11:05 +00:00
SDL Wiki Bot 17a0fe3a0c Sync SDL3 wiki -> header 2023-11-05 14:06:05 +00:00
SDL Wiki Bot 14d2471a8f Sync SDL3 wiki -> header 2023-11-05 14:04:05 +00:00
SDL Wiki Bot 2ad22eeeb5 Sync SDL3 wiki -> header 2023-11-05 14:02:06 +00:00
Sam Lantinga 930438dfb7 Added note that the #ifdef is for !__IOS__ 2023-11-05 00:33:08 -07:00
kanjitalk755 c56583fe45 Fix duplicate symbol on iOS/tvOS 2023-11-05 00:31:27 -07:00
kanjitalk755 2b62f25a6f Add SDL_sysmain_callbacks.c to the Xcode project 2023-11-05 00:31:27 -07:00
kanjitalk755 4ab31ca678 Fix dropping file event 2023-11-05 00:14:56 -07:00
Sam Lantinga 5dce4bc716 Makes SDLInputConnection and DummyEdit public classes (thanks Cole!)
I've added an additional patch that expands on the same basic idea as the first one; it makes SDLInputConnection and DummyEdit into public classes so that they can be overridden from the Xamarin end if their functionality needs to be extended. (In my case, I need to change the type of software keyboard that's displayed.)

Fixes https://github.com/libsdl-org/SDL/issues/2785
2023-11-04 23:22:55 -07:00
Sam Lantinga d3f2eb2aba Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
XINPUT_STATE_EX isn't actually a thing, we can just use the normal XINPUT_STATE

Fixes https://github.com/libsdl-org/SDL/issues/2797

(cherry picked from commit e8f4045d0bccacbf8f4b716d0dde17140e9f2cc4)
2023-11-04 22:28:09 -07:00
Sam Lantinga 3a482ebae0 Add createSDLMainRunnable() to SDLActivity (thanks Cole!)
This patch adds a new createSDLMainRunnable() method to SDLActivity.

Currently, SDL on Android expects to find SDL_main somewhere in native code. When using SDL in a Xamarin application, however, what we really want to do is write our entrypoint in managed code. The easiest way to do this is to allow subclasses of SDLActivity to provide their own Runnable to the SDL thread, as in the attached patch.

Fixes https://github.com/libsdl-org/SDL/issues/2785
2023-11-04 21:18:16 -07:00
Sam Lantinga b9784feb24 Fixed potential uninitialized memory access (thanks Mathieu!)
GetRawInputDeviceList() can return a different number of devices than was allocated.

Fixes https://github.com/libsdl-org/SDL/issues/2759
2023-11-04 21:11:53 -07:00
Sam Lantinga 75ea3a8d32 Dynamically allocate long text for SDL_EVENT_TEXT_INPUT events
This prevents input text from being split across Unicode combining or modifier characters, and in practice allocations will rarely happen.
2023-11-04 20:55:10 -07:00
Sam Lantinga 2a1660ab51 Additional cleanup for SDL_RWprintf() (thanks @sezero!) 2023-11-04 20:47:08 -07:00
Ryan C. Gordon e5f2cea234
Sync wiki -> headers 2023-11-04 22:18:38 -04:00
Sam Lantinga ad842dd5ad Fixed a typo in SDL_log.h 2023-11-04 16:46:08 -07:00
Sam Lantinga f9d11807c0 Added SDL_RWprintf() and SDL_RWvprintf() to do formatted printing to an SDL_rwops stream
Fixes https://github.com/libsdl-org/SDL/issues/2390
2023-11-04 16:46:08 -07:00
Frank Praznik 52c4e3eab3 events: Update self-referential pointers when copying event objects
Pointers to static internal data need to be updated when copying events, or the cleanup code will attempt to free old stack data that went out of scope.
2023-11-04 18:07:24 -04:00
Sam Lantinga 91f0456391 Add the source application for drag and drop events (thanks Nathan!)
This is only implemented on iOS, but is useful for third party application integrations.

Fixes https://github.com/libsdl-org/SDL/issues/2024
2023-11-04 13:00:41 -07:00
Ryan C. Gordon 1a8bf31a69 include: Fixing whitespace on SDL_MixAudioFormat. 2023-11-04 15:06:41 -04:00
Sam Lantinga d07a264a9b Use the default UCS2/UCS4 conversion rather than non-portable INTERNAL encoding
Fxies https://github.com/libsdl-org/SDL/issues/1497
2023-11-04 12:01:30 -07:00
Ryan C. Gordon 780b6612a9 wayland: Wayland_Vulkan_GetInstanceExtensions didn't set the count variable.
Fixes #8468.
2023-11-04 14:53:24 -04:00
Sam Lantinga 46b940d571 Updated documentation to note that the event callback is called on the same thread as the main iteration callback 2023-11-04 11:31:54 -07:00
Sam Lantinga 4481754359 Make sure we only dispatch events on the main thread when using application callbacks 2023-11-04 11:27:58 -07:00
Sam Lantinga 274da8561c Updated the migration guide to note that you can check the return value of SDL_AddEventWatch() 2023-11-04 10:42:28 -07:00
Sam Lantinga ad9dcdbbce Clarify that you should use the other field when reading the event 2023-11-04 09:58:35 -07:00
Ryan C. Gordon a19029e3c1
docs: Updated README-main-functions.md based on feedback. 2023-11-04 10:03:10 -04:00
Ryan C. Gordon 019468dc59
main: Check for SDL_AddEventWatch failure, now that it can report it. 2023-11-04 10:03:10 -04:00
Sam Lantinga 7e445da569 Added SDL_CleanupEvent()
This is used to free any dynamically allocated memory in events.
2023-11-04 06:47:24 -07:00
Ivan Mogilko c4bf05fd9d Added subsystem refcount tests to testautomation 2023-11-04 00:52:08 -07:00
Ivan Mogilko 7f65ed6461 Handle subsystem dependencies recursively
Existing code is erroneous, because it adds or removes dependency's ref count based on number of InitSubSystem/QuitSubSystem calls, while ref count diff should depend on number of inited or quit dependents.
Recursive approach seems to be simplest solution that guarantees proper ref count.
2023-11-04 00:52:08 -07:00
Sam Lantinga a6b85c81cc Fixed build 2023-11-03 22:38:01 -07:00
SDL Wiki Bot 3ab6670cb1 Sync SDL3 wiki -> header 2023-11-04 05:36:15 +00:00
Sam Lantinga f439ccfc1a Updated return values for SDL event functions
SDL_PollEvent(), SDL_WaitEvent(), and SDL_WaitEventTimeout() all return SDL_bool.
SDL_AddEventWatch() returns an int result code.

Also improved timeout accuracy in SDL_WaitEventTimeout()
2023-11-03 22:31:42 -07:00
Sam Lantinga e0379c3b37 Grab events in large chunks in SDL_IterateMainCallbacks()
This is more efficient, especially since we're just going to discard them.
2023-11-03 21:47:44 -07:00
Sam Lantinga ad5264e54f Don't run SDL_IterateMainCallbacks() if the init call returns an exit code
This fixes a crash in testsprite if you pass invalid command line parameters.
2023-11-03 21:35:42 -07:00
Sam Lantinga dad1a84be4 Fixed building Vivante video driver 2023-11-03 14:56:15 -07:00
Sam Lantinga fe175d025f Fixed building Vivante video driver 2023-11-03 14:54:11 -07:00
Sam Lantinga 0b460f34ba The HP HyperX controllers have a share button 2023-11-03 14:47:20 -07:00
Sam Lantinga f3261fedcc Code cleanup now that SDL_bool is equivalent to a C boolean expression 2023-11-03 09:54:04 -07:00