Commit Graph
100 Commits
Author SHA1 Message Date
Sam Lantinga b3612f6462 testautomation: fixed RLE operation test on big endian systems
Fixes https://github.com/libsdl-org/SDL/issues/14348
2025-10-29 16:26:31 +00:00
Sam Lantinga 8b8c51573b Disabled incorrect 16-bit Altivec blitters 2025-10-29 16:11:25 +00:00
Sam Lantinga 84fac6ca44 testautomation: verify that RLE operation output is correct 2025-10-29 09:07:56 -07:00
Sam Lantinga bf0752a8d7 Fixed converting RLE encoded surfaces to other formats 2025-10-29 09:06:25 -07:00
Sam Lantinga c4cef905ae Updated internal documentation 2025-10-29 08:39:56 -07:00
Sam Lantinga cecf4b0d4e Fixed the right shoulder button on the 8BitDo Pro 3 2025-10-28 14:55:06 -07:00
Sam Lantinga 78f9cb44c3 Added a Linux mapping for the 8BitDo Pro 3 2025-10-28 14:13:40 -07:00
Sam Lantinga 2d14a237dc Fixed trying to grab the mouse when losing keyboard focus
Fixes https://github.com/libsdl-org/SDL/issues/14350
2025-10-28 07:15:43 -07:00
Sam Lantinga 933beeb18b Fixed warning: no previous extern declaration for non-static variable 2025-10-27 17:52:05 -07:00
Sam Lantinga 965ac7f406 Fixed warning: implicit conversion loses integer precision: 'long' to 'int' 2025-10-27 17:49:49 -07:00
Sam Lantinga 90242312fe Restored the original OpenBSD Xbox 360 controller mapping 2025-10-27 17:39:29 -07:00
Sam Lantinga b305534edc Completed removing predefined Xbox 360 mappings for Linux
Also removed them for OpenBSD, since it's not clear which ones, if any, are needed.
2025-10-27 17:34:23 -07:00
Sam Lantinga be1d44279c Fixed error: incompatible function pointer types passing
SDL/src/sensor/emscripten/SDL_emscriptensensor.c:80:5: error: incompatible function pointer types passing
      'int (*)(int, const EmscriptenDeviceMotionEvent *, void *)' (aka 'int (*)(int, const struct EmscriptenDeviceMotionEvent *, void *)') to parameter of type 'em_devicemotion_callback_func' (aka
      'bool (*)(int, const struct EmscriptenDeviceMotionEvent *, void *)') [-Wincompatible-function-pointer-types]
   80 |     emscripten_set_devicemotion_callback((void *)0, false, &SDL_EMSCRIPTEN_SensorCallback);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-10-27 10:13:57 -07:00
Sam Lantinga f5966890b0 Added a note that SDL_LoadPNG() is designed for trusted images
Fixes https://github.com/libsdl-org/SDL/issues/14338
2025-10-27 08:38:00 -07:00
Sam Lantinga 01aa1882f8 Added a patch note for SDL_ELF_NOTE_DLOPEN
Fixes https://github.com/libsdl-org/SDL/issues/14337
2025-10-27 08:28:05 -07:00
Sam Lantinga 0ea20a5f86 Fix NULL pointer dereference in SDL_RenderGeometryRaw with NPOT textures (thanks @bleeqer!)
Fixes https://github.com/libsdl-org/SDL/issues/14329
Closes https://github.com/libsdl-org/SDL/pull/14331
2025-10-26 08:10:52 -07:00
Sam Lantinga e08edab180 Log object leaks at debug level
End users don't care about this. Developers can enable debug logs, run with DEBUG_INVOCATION=1, or use other leak checking tools to detect these.
2025-10-25 15:13:37 -07:00
Sam Lantinga ffd0ca4391 Perform full rectangle intersection for empty rects
If we don't do that, we leave the x and y values uninitialized.

Fixes https://github.com/libsdl-org/sdl12-compat/issues/365
2025-10-25 13:48:48 -07:00
Sam Lantinga 51b401d418 Fixed OTP text entry on iOS (thanks @pipiwoaini!)
Fixes https://github.com/libsdl-org/SDL/issues/13717
2025-10-24 11:02:37 -07:00
Sam Lantinga 1506c40ec8 Fixed line endings in FindLibUSB.cmake 2025-10-24 10:48:25 -07:00
Sam Lantinga 404ec13fbb Fixed building with libusb on FreeBSD 2025-10-24 10:41:08 -07:00
Sam Lantinga d2c6aeea7d Add the bundle framework path to the libMoltenVK.dylib paths
Fixes https://github.com/libsdl-org/SDL/issues/14313
2025-10-24 10:33:22 -07:00
Sam Lantinga c959f9f0d8 Define SDL_FILE as __FILE_NAME__, if available 2025-10-24 10:01:01 -07:00
Sam Lantinga be781fc8f5 Updated to version 3.3.3 for development 2025-10-23 22:41:03 -07:00
Sam Lantinga b31c4b70b3 Updated version and documentation for 3.3.2 preview release 2025-10-23 15:20:26 -07:00
Sam Lantinga 1fa6475c90 Added support for saving indexed PNG images
Fixes https://github.com/libsdl-org/SDL/issues/14303
2025-10-23 12:40:41 -07:00
Sam Lantinga 6d095575e8 Clarify thread-safety information for surface functions 2025-10-23 07:52:48 -07:00
Sam Lantinga e18d63a4e2 Added SDL_RotateSurface()
Fixes https://github.com/libsdl-org/SDL/issues/14269
2025-10-22 17:55:02 -07:00
Sam Lantinga a402af506c Removed SDL_FILE from source code 2025-10-22 10:52:18 -07:00
Sam Lantinga f79ede100b Removed __FILE__ from source code 2025-10-22 10:48:36 -07:00
Sam Lantinga 999f782ad3 Be more selective when blacklisting controller touchpads
On Android, the PS4 controller is called "Wireless Controller Touchpad"
Fixes https://github.com/libsdl-org/SDL/issues/14294
2025-10-22 10:44:08 -07:00
Sam Lantinga e58648d592 Removed call to ID3D11DeviceContext1_DiscardView() (thanks @pipiwoaini!)
This is unnecessary and can cause issues after a resize or device removal.

Fixes https://github.com/libsdl-org/SDL/issues/14283
2025-10-21 13:01:30 -07:00
Sam Lantinga 9d32e0e881 Fixed data alignment for PNG cursors (thanks @Kontrabant!) 2025-10-21 10:50:09 -07:00
Sam Lantinga af6f517453 Use CreateIconFromResource() for all cursors (#14285)
This allows us to properly adjust the size for DPI scaling and both static and animated cursors have consistent behavior.

Fixes https://github.com/libsdl-org/SDL/issues/14281
2025-10-21 09:38:26 -07:00
Sam Lantinga 0e351efbbc testcustomcursor: set the hotspot to the middle of the cross 2025-10-20 09:48:03 -07:00
Sam Lantinga 2f810e0a5f Copy properties when converting a surface to a new format
This fixes retaining the cursor hotspot when converting cursor frames to SDL_PIXELFORMAT_ARGB8888
2025-10-19 23:51:19 -07:00
Sam Lantinga 23fcf53c53 Treat a single frame animated cursor as a normal color cursor 2025-10-19 23:03:54 -07:00
Sam Lantinga bd86e85249 Added fallback support for animated cursors 2025-10-19 22:53:10 -07:00
Sam Lantinga 0e87ba163f Fixed crash if the animated cursor had a NULL frame 0 2025-10-19 22:53:10 -07:00
Sam Lantinga cae27a0ec7 Set an error if a cursor image is too large 2025-10-19 18:25:05 -07:00
Sam Lantinga b16ad6f10f Allow any init flags to be passed to SDLTest_CommonCreateState() 2025-10-15 21:57:37 -07:00
Sam Lantinga 6109fa6794 The names of joysticks and gamepads are valid after they've been removed 2025-10-15 21:57:37 -07:00
Sam Lantinga f844f3e10b Only pass UIPress from game controllers and remotes if the're not open
Fixes https://github.com/libsdl-org/SDL/issues/14080
2025-10-14 12:43:22 -07:00
Sam Lantinga d819106c65 Try matching gamepad mappings with CRC first
Fixes https://github.com/libsdl-org/SDL/issues/13874
2025-10-14 10:30:03 -07:00
Sam Lantinga 98944ecd0c Added the 8BitDo Ultimate 2C Wireless Controller to the Xbox controller list
Fixes https://github.com/libsdl-org/SDL/issues/14127
2025-10-13 18:46:58 -07:00
Sam Lantinga 23b487ceda Added testyuv to the SDLTest Xcode project 2025-10-13 15:27:13 -07:00
Sam Lantinga 015cc6aa6c Fixed accidentally using INDEX8 textures for RGB24 surfaces 2025-10-13 15:27:13 -07:00
Sam Lantinga 7a49ce71a1 Handle partial OpenGL shader availability
The pixelart shaders are not supported on OpenGL 2.1 (GLSL 130 isn't available)

Fixes the OpenGL renderer on macOS
2025-10-13 15:27:13 -07:00
Sam Lantinga 57cd131b7a testpalette: use SDL_SCALEMODE_NEAREST for single pixel copies 2025-10-13 14:25:09 -07:00
Sam Lantinga a58ae3a94f Added WASAPI support for SDL_HINT_AUDIO_DEVICE_STREAM_ROLE
Also added SDL_HINT_AUDIO_DEVICE_RAW_STREAM

Fixes https://github.com/libsdl-org/SDL/issues/14091
2025-10-13 14:20:19 -07:00
Sam Lantinga 361f7e0873 Fixed power state reporting for the Nintendo Joy-Con Charging Grip 2025-10-13 10:34:22 -07:00
Sam Lantinga 6b5b0ca90a Fixed header include guards 2025-10-13 09:46:15 -07:00
Sam Lantinga 831ec4dc6c Added support for the ZENAIM ARCADE CONTROLLER 2025-10-13 08:56:10 -07:00
Sam Lantinga c7cc7ec9af Be more precise about the layout used when latin_letters is enabled 2025-10-12 21:54:35 -07:00
Sam Lantinga 6e63f255b9 Added a reference to SDL_HINT_KEYCODE_OPTIONS from SDL_Keycode documentation 2025-10-12 21:51:14 -07:00
Sam Lantinga d7ad47e2ca Added SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 11:15:47 -07:00
Sam Lantinga 513de0f0ec Don't allow SDL_TEXTURE_ADDRESS_WRAP if it's not supported
Fixes https://github.com/libsdl-org/SDL/issues/13908
2025-10-12 10:46:48 -07:00
Sam Lantinga 1ed093ad8b Corrected texture colors on PS2 (thanks @Trinth!)
Fixes https://github.com/libsdl-org/SDL/issues/12395
2025-10-12 09:20:00 -07:00
Sam Lantinga bb7bf28433 Documented environment setup for PS2 development 2025-10-12 09:20:00 -07:00
Sam Lantinga 70eceec77b Replace stb_image_write with miniz for SDL_SavePNG()
Fixes https://github.com/libsdl-org/SDL/issues/14219
2025-10-11 20:32:19 -07:00
Sam Lantinga 480f069cec Copy the palette instead of referencing it when creating a texture
Fixes https://github.com/libsdl-org/SDL/issues/14213
2025-10-11 11:01:15 -07:00
Sam Lantinga 9d635fe641 Flush rendering if a texture palette is in use when destroyed 2025-10-10 17:42:27 -07:00
Sam Lantinga 3fcac8cc44 Added support for CF_DIBV5 and PNG clipboard formats on Windows 2025-10-10 17:42:27 -07:00
Sam Lantinga 9d3dd8f001 testclipboard: make the window resizable
This is handy to see multiple image formats on the clipboard
2025-10-10 17:42:27 -07:00
Sam Lantinga 6f8fbf5cea SDL_EVENT_CLIPBOARD_UPDATE isn't sent when the primary selection changes 2025-10-10 13:27:15 -07:00
Sam Lantinga 692c71a677 The dlopen note functionality is only used on UNIX platforms 2025-10-10 12:47:42 -07:00
Sam Lantinga ee622c570a Made SDL_dlopennote.h a public header 2025-10-10 12:47:42 -07:00
Sam Lantinga 1871b998cd Added SDL_EVENT_SCREEN_KEYBOARD_SHOWN and SDL_EVENT_SCREEN_KEYBOARD_HIDDEN
Fixes https://github.com/libsdl-org/SDL/issues/13049
2025-10-10 10:14:07 -07:00
Sam Lantinga 5441d33c0e testime: toggle text input with a mouse click 2025-10-10 10:14:07 -07:00
Sam Lantinga e1305ec2e2 Updated Xcode project for the switch to png test data 2025-10-10 10:14:07 -07:00
Sam Lantinga 17989940f2 Fixed SDL_BlitSurfaceTiledWithScale() with very small scale (thanks @bleeqer!) 2025-10-10 08:59:27 -07:00
Sam Lantinga 4a00aedd70 Updated .gitignore for png test data 2025-10-10 08:59:27 -07:00
Sam Lantinga 6677fad1c8 Added SDL_EVENT_DISPLAY_USABLE_BOUNDS_CHANGED
Fixes https://github.com/libsdl-org/SDL/issues/12785
2025-10-09 19:15:45 -07:00
Sam Lantinga d92079f2b7 testsprite: only use transparent alpha on transparent windows
Fixes https://github.com/libsdl-org/SDL/issues/14105
2025-10-09 14:32:08 -07:00
Sam Lantinga b5c9a83f65 Display error messages when evdev devices can't be opened
Fixes https://github.com/libsdl-org/SDL/issues/13141
2025-10-09 13:18:56 -07:00
Sam Lantinga 23e3cbec20 Only call clipboard callbacks with mime types they expect
Also clarified that returning NULL from a callback sends zero length data to the receiver, which should be able to handle that.

Fixes https://github.com/libsdl-org/SDL/issues/9586
2025-10-09 12:20:19 -07:00
Sam Lantinga 9cf7cdf23a Only return current clipboard data under X11
Fixes https://github.com/libsdl-org/SDL/issues/10192
2025-10-09 12:20:19 -07:00
Sam Lantinga 3c0a6c32d4 Fixed crash getting clipboard data processing clipboard events on X11
SDL_PumpEvents() was freeing the temporary memory in the clipboard event, so if the application was iterating over the mime types in the event and retrieving the clipboard data, it would crash after the first entry.
2025-10-09 12:20:19 -07:00
Sam Lantinga 0e7d5620c2 testclipboard: added support for UCS-2 and UCS-4 text
Chrome uses UCS-2 text for text/x-moz-url content
2025-10-09 12:20:19 -07:00
Sam Lantinga ec0e84fc0a testclipboard: support both BMP and PNG clipboard images 2025-10-09 12:20:19 -07:00
Sam Lantinga cf97ca1511 Fixed style 2025-10-09 12:20:19 -07:00
Sam Lantinga a6fc2c4b60 Use ndk r28 by default for 16KB page alignment 2025-10-08 21:34:19 -07:00
Sam Lantinga 5dc65f829f check_android_jni.py: make sure we're using python3 2025-10-08 21:32:30 -07:00
Sam Lantinga 9a6455a526 Disable GameInput for mouse and keyboard by default
We're going to wait for this to get more testing before enabling it by default.

Fixes https://github.com/libsdl-org/SDL/issues/13846
2025-10-08 21:22:22 -07:00
Sam Lantinga 2a92a3c9c5 Recreate the Vulkan GPU swap chain when resuming on Android
Fixes https://github.com/libsdl-org/SDL/issues/12957
2025-10-08 21:06:17 -07:00
Sam Lantinga 6f4993ddee Ignore invalid width/height in setOrientationBis() 2025-10-08 20:14:51 -07:00
Sam Lantinga 00ffddece8 Ignore VK_SUBOPTIMAL_KHR on the Android platform
This is returned whenever the device has been rotated, and can be safely ignored.

Fixes https://github.com/libsdl-org/SDL/issues/12950
2025-10-08 20:02:31 -07:00
Sam Lantinga a2a60f75c7 Temporarily disabled texture binding validation
There are some advanced use cases that trip over this, so temporarily disabling the validation pending further review.

Reference: https://github.com/libsdl-org/SDL/issues/13871
2025-10-08 19:50:48 -07:00
Sam Lantinga 84b0565096 Fixed potential memory leak 2025-10-08 19:44:03 -07:00
Sam Lantinga 3316dde0c2 Improved error information when renderer creation fails
On Android, if you create a window with SDL_WINDOW_OPENGL, you can't create a Vulkan surface. The error message has been improved to reflect this, and the error is propagated back up to the application.

Also added warn level logging if the renderer couldn't be created.
2025-10-08 19:36:19 -07:00
Sam Lantinga edf5f9ec5c Properly upgrade a window to Vulkan when creating a Vulkan renderer 2025-10-08 19:17:11 -07:00
Sam Lantinga d4b684311e Added the Wooting 60HE keyboard to the controller blacklist 2025-10-08 16:06:17 -07:00
Sam Lantinga caa33cb018 Removed InvalidateRect() when moving and resizing
This was added in 2016, presumably to help address the move/resize issues on Windows, which have been since been addressed by the live-resize functionality.

Fixes https://github.com/libsdl-org/SDL/issues/14079
2025-10-08 13:32:19 -07:00
Sam Lantinga 7914bdb7ea Only call WIN_RoUninitialize() if WIN_RoInitialize() succeeded
Fixes https://github.com/libsdl-org/SDL/issues/14178
2025-10-08 13:15:48 -07:00
Sam Lantinga 8830b466d0 Improve handling of surfaces with NULL pixels
Fixes https://github.com/libsdl-org/SDL/issues/14059
2025-10-08 12:40:29 -07:00
Sam Lantinga 244ae39b30 Optimized the 16-bit -> 32-bit SSE pixel conversion
Test code:
---
int main( int argc, char *argv[] )
{
    SDL_Surface *orig = SDL_LoadPNG("testyuv.png");
    SDL_Surface *surf16 = SDL_ConvertSurface(orig, SDL_PIXELFORMAT_RGB565);
    SDL_Surface *surf32 = SDL_ConvertSurface(surf16, SDL_PIXELFORMAT_ARGB8888);

    Uint64 then = SDL_GetTicks();
    for (int i = 0; i < 100000; ++i) {
        SDL_BlitSurface(surf16, NULL, surf32, NULL);
    }
    Uint64 now = SDL_GetTicks();
    SDL_Log("Blit took %d ms\n", (int)(now - then));
    return 0;
}
---

Results on my system:
BlitNtoN: Blit took 34522 ms
Blit_RGB565_32 (3 LUT): Blit took 9316 ms
Blit_RGB565_32 (1 LUT): Blit took 5268 ms
Blit_RGB565_32_SSE41: Blit took 1619 ms
2025-10-07 16:31:14 -07:00
Sam Lantinga 168de63a7a Switched back to a single LUT for 16-bit -> 32-bit pixel conversion
This beats the previous 3-LUT version and even beats SSE on my system.

Test code:
---
int main( int argc, char *argv[] )
{
    SDL_Surface *orig = SDL_LoadPNG("testyuv.png");
    SDL_Surface *surf16 = SDL_ConvertSurface(orig, SDL_PIXELFORMAT_RGB565);
    SDL_Surface *surf32 = SDL_ConvertSurface(surf16, SDL_PIXELFORMAT_ARGB8888);

    Uint64 then = SDL_GetTicks();
    for (int i = 0; i < 100000; ++i) {
        SDL_BlitSurface(surf16, NULL, surf32, NULL);
    }
    Uint64 now = SDL_GetTicks();
    SDL_Log("Blit took %d ms\n", (int)(now - then));
    return 0;
}
---

Results on my system:
BlitNtoN: Blit took 34522 ms
Blit_RGB565_32 (3 LUT): Blit took 9316 ms
Blit_RGB565_32 (1 LUT): Blit took 5268 ms
Blit_RGB565_32_SSE41: Blit took 6399 ms
2025-10-07 16:31:14 -07:00
Sam Lantinga dbd5dd8c75 Ensure 16-bit -> 32-bit conversion is consistent between blitters
The SSE, LUT, and other blitters should have the same results for 16-bit -> 32-bit conversion
2025-10-07 16:31:14 -07:00
Sam Lantinga e9c7cfb165 Revert "Use rounded results for expanding values to 8-bits"
This reverts commit ba5be7af74.

We actually want to use high bits and replicated low bits, to match SIMD value expansion
2025-10-06 23:14:38 -07:00
Sam Lantinga ba5be7af74 Use rounded results for expanding values to 8-bits 2025-10-06 21:28:42 -07:00