Commit Graph

1529 Commits

Author SHA1 Message Date
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
Sam Lantinga
4961af4569 SDL_GetJoysticks() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
b32c9615a7 SDL_GetHaptics() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
9de8cb888a SDL_GetFullscreenDisplayModes() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
9758e102bc SDL_GetDisplays() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
01199469de SDL_GetCameras() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
0fe6603747 SDL_GetCameraSupportedFormats() follows the SDL_GetStringRule
Also changed the function to return an array of pointers and added example usage to testcamera
2024-07-19 12:22:03 -07:00
Sam Lantinga
bdafc8e212 SDL_GetWindows() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
8ca6caeda5 SDL_GetAudioPlaybackDevices() and SDL_GetAudioRecordingDevices() follow the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
ef884c8aa6 Transfer event memory between the local pool and the event queue
This allows threads to free memory from their local pool without affecting events that are queued, and to transfer memory ownership cleanly between threads that are queuing and dequeuing events.
2024-07-19 12:22:03 -07:00
Sam Lantinga
38a301a3f9 Added automated tests to verify SDL_ClearSurface() and SDL_PremultiplySurfaceAlpha() 2024-07-17 18:04:16 -07:00
Amir
5db08b86ca Fix warning for Android NDK compiler: "function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]"
https://stackoverflow.com/questions/42125/warning-error-function-declaration-isnt-a-prototype
In C int foo() and int foo(void) are different functions. int foo() accepts an arbitrary number of arguments, while int foo(void) accepts 0 arguments. In C++ they mean the same thing.
2024-07-17 14:09:11 -07:00
Sam Lantinga
5f5e91eab6 Reverted 3d2e5a0b66
Applying these changes to external code doesn't actually improve anything, and within the context of the other Get* functions for renderers and surfaces, these stand out as outliers, so I'm going to back this change out.
2024-07-17 10:27:37 -07:00
Sam Lantinga
3d2e5a0b66 Fixed a few remaining functions to directly return their values instead of an error code. 2024-07-16 21:32:17 -07:00
Sam Lantinga
1e828eec57 Fixed warning C4244: '=': conversion from 'float' to 'int', possible loss of data 2024-07-16 21:32:17 -07:00
Sam Lantinga
7c0307060d Textures with alpha format default to SDL_BLENDMODE_BLEND
Fixes https://github.com/libsdl-org/SDL/issues/9941
2024-07-16 18:50:22 -07:00
Sam Lantinga
b5292bdec9 Added blend mode testing for 8-bit surfaces 2024-07-16 17:57:12 -07:00
Ryan C. Gordon
4dda785c69 gamepad: Several gamepad mapping functions now follow the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
ed1f93cd11 filesystem: SDL_Glob*Directory() functions now follow the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
52bf7ff42d filesystem: SDL_GetPrefPath() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
2321726ff1 filesystem: SDL_GetUserFolder() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
d40b89dff6 clipboard: SDL_GetPrimarySelectionText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
158fc459f1 clipboard: SDL_GetClipboardText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
3bc81a81f5 filesystem: SDL_GetBasePath() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

A little code hygiene work was applied to some of the platform bits on top of
this.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00