Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sdl2-compat for openSUSE:Factory checked in at 2025-12-05 16:50:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sdl2-compat (Old) and /work/SRC/openSUSE:Factory/.sdl2-compat.new.1939 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sdl2-compat" Fri Dec 5 16:50:48 2025 rev:6 rq:1321065 version:2.32.60 Changes: -------- --- /work/SRC/openSUSE:Factory/sdl2-compat/sdl2-compat.changes 2025-11-01 23:34:38.742545956 +0100 +++ /work/SRC/openSUSE:Factory/.sdl2-compat.new.1939/sdl2-compat.changes 2025-12-05 16:51:17.754990546 +0100 @@ -1,0 +2,8 @@ +Thu Dec 4 05:02:05 UTC 2025 - Jan Engelhardt <[email protected]> + +- Update to release 2.32.60 + * Fixed crash at startup in Dwarf Fortress and Stellaris + * Fixed mouse stuttering in Amiberry + * Fixed the viewport not being reset when the window is resized + +------------------------------------------------------------------- Old: ---- sdl2-compat-2.32.58.tar.gz sdl2-compat-2.32.58.tar.gz.sig New: ---- sdl2-compat-2.32.60.tar.gz sdl2-compat-2.32.60.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sdl2-compat.spec ++++++ --- /var/tmp/diff_new_pack.D1BS6R/_old 2025-12-05 16:51:20.071087724 +0100 +++ /var/tmp/diff_new_pack.D1BS6R/_new 2025-12-05 16:51:20.087088395 +0100 @@ -19,7 +19,7 @@ %define lname libSDL2-2_0-0 %global _lto_cflags %_lto_cflags -ffat-lto-objects Name: sdl2-compat -Version: 2.32.58 +Version: 2.32.60 Release: 0 Summary: SDL-2.0 Compatibility Layer for Simple DirectMedia Layer 3.0 License: Zlib ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.D1BS6R/_old 2025-12-05 16:51:20.291096954 +0100 +++ /var/tmp/diff_new_pack.D1BS6R/_new 2025-12-05 16:51:20.295097122 +0100 @@ -1,5 +1,5 @@ -mtime: 1761905282 -commit: a5c62c76ea7f2c15206e58b701567d8a793dd7c18f098cd32f6dcb537e081ec7 +mtime: 1764830424 +commit: 4660bd055f46c0d4a9fcfa09d449d8e626a6659028b1aa86fef06252a66c1676 url: https://src.opensuse.org/jengelh/sdl2-compat revision: master ++++++ sdl2-compat-2.32.58.tar.gz -> sdl2-compat-2.32.60.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/.git-hash new/sdl2-compat-2.32.60/.git-hash --- old/sdl2-compat-2.32.58/.git-hash 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/.git-hash 2025-12-02 20:40:20.000000000 +0100 @@ -1 +1 @@ -7c830290c6325190147abb7aedf39ef0e914d71a +9831c2e1fcf0a115a351339dfa29d7f32e202f36 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/CMakeLists.txt new/sdl2-compat-2.32.60/CMakeLists.txt --- old/sdl2-compat-2.32.58/CMakeLists.txt 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/CMakeLists.txt 2025-12-02 20:40:20.000000000 +0100 @@ -3,7 +3,7 @@ # cmake -DSDL3_INCLUDE_DIRS=/opt/SDL3/include [other stuff ....] cmake_minimum_required(VERSION 3.0...4.1) -project(sdl2_compat VERSION 2.32.58 LANGUAGES C) +project(sdl2_compat VERSION 2.32.60 LANGUAGES C) if(POLICY CMP0074) # CMP0074: find_package() uses <PackageName>_ROOT variables. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/REVISION.txt new/sdl2-compat-2.32.60/REVISION.txt --- old/sdl2-compat-2.32.58/REVISION.txt 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/REVISION.txt 2025-12-02 20:40:20.000000000 +0100 @@ -1 +1 @@ -release-2.32.58-0-g7c83029 +release-2.32.60-0-g9831c2e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/build-scripts/update-version.sh new/sdl2-compat-2.32.60/build-scripts/update-version.sh --- old/sdl2-compat-2.32.58/build-scripts/update-version.sh 2023-08-03 20:55:10.000000000 +0200 +++ new/sdl2-compat-2.32.60/build-scripts/update-version.sh 2025-10-30 20:21:14.000000000 +0100 @@ -44,13 +44,15 @@ if [[ "x$((${MINOR}%2))" = "x0" ]]; then SOVER="$((100 * ${MINOR})).${PATCH}" DYVER="$((100 * ${MINOR} + 1)).${PATCH}" + DYCOMPAT="$((100 * ${MINOR} + 1)).0" else SOVER="$((100 * ${MINOR} + ${PATCH})).0" DYVER="$((100 * ${MINOR} + ${PATCH} + 1)).0" + DYCOMPAT="$((100 * ${MINOR} + ${PATCH} + 1)).0" fi perl -w -pi -e 's/(SHLIB\s+=\s+libSDL2-2\.0\.so\.0\.)\d+\.\d+/${1}'${SOVER}'/;' src/Makefile.linux -perl -w -pi -e 's/(-Wl,-compatibility_version,)\d+\.\d+/${1}'${DYVER}'/;' src/Makefile.darwin +perl -w -pi -e 's/(-Wl,-compatibility_version,)\d+\.\d+/${1}'${DYCOMPAT}'/;' src/Makefile.darwin perl -w -pi -e 's/(-Wl,-current_version,)\d+.\d+/${1}'${DYVER}'/;' src/Makefile.darwin echo "Running build-scripts/test-versioning.sh to verify changes..." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/include/SDL2/SDL_revision.h new/sdl2-compat-2.32.60/include/SDL2/SDL_revision.h --- old/sdl2-compat-2.32.58/include/SDL2/SDL_revision.h 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/include/SDL2/SDL_revision.h 2025-12-02 20:40:20.000000000 +0100 @@ -1,6 +1,6 @@ #ifdef SDL_VENDOR_INFO -#define SDL_REVISION "release-2.32.58-0-g7c83029 (" SDL_VENDOR_INFO ")" +#define SDL_REVISION "release-2.32.60-0-g9831c2e (" SDL_VENDOR_INFO ")" #else -#define SDL_REVISION "release-2.32.58-0-g7c83029" +#define SDL_REVISION "release-2.32.60-0-g9831c2e" #endif #define SDL_REVISION_NUMBER 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/include/SDL2/SDL_system.h new/sdl2-compat-2.32.60/include/SDL2/SDL_system.h --- old/sdl2-compat-2.32.58/include/SDL2/SDL_system.h 2025-09-15 04:23:02.000000000 +0200 +++ new/sdl2-compat-2.32.60/include/SDL2/SDL_system.h 2025-11-14 00:28:40.000000000 +0100 @@ -572,6 +572,26 @@ */ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); +/** + * Get the protocol activation URI if the app was launched via protocol + * activation. + * + * When a UWP/WinRT app is launched via a custom URI scheme (e.g., + * myapp://action?param=value), this function retrieves the full activation + * URI string. + * + * The URI is only available once per activation - after the first successful + * call, subsequent calls will return NULL. This ensures the URI is processed + * only once. + * + * \returns the protocol activation URI as a UTF-8 string that must be freed + * with SDL_free(), or NULL if the app was not activated via protocol + * or the URI was already retrieved. + * + * \since This function is available since SDL 2.33.0. + */ +extern DECLSPEC char * SDLCALL SDL_WinRTGetProtocolActivationURI(void); + #endif /* __WINRT__ */ /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/include/SDL2/SDL_version.h new/sdl2-compat-2.32.60/include/SDL2/SDL_version.h --- old/sdl2-compat-2.32.58/include/SDL2/SDL_version.h 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/include/SDL2/SDL_version.h 2025-12-02 20:40:20.000000000 +0100 @@ -58,7 +58,7 @@ */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 32 -#define SDL_PATCHLEVEL 58 +#define SDL_PATCHLEVEL 60 /** * Macro to determine SDL version program was compiled against. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/src/Makefile.darwin new/sdl2-compat-2.32.60/src/Makefile.darwin --- old/sdl2-compat-2.32.58/src/Makefile.darwin 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/src/Makefile.darwin 2025-12-02 20:40:20.000000000 +0100 @@ -20,7 +20,7 @@ LDFLAGS = -dynamiclib -Wl,-undefined,error -Wl,-single_module #LDFLAGS+= -Wl,-headerpad_max_install_names LDFLAGS+= -Wl,-install_name,"/usr/local/lib/$(DYLIB)" -LDFLAGS+= -Wl,-compatibility_version,3201.0 -Wl,-current_version,3201.58 +LDFLAGS+= -Wl,-compatibility_version,3201.0 -Wl,-current_version,3201.60 LDLIBS = -Wl,-framework,AppKit # this is needed for x86_64 - cross-gcc might not add it. #LDLIBS += -Wl,-lbundle1.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/src/Makefile.linux new/sdl2-compat-2.32.60/src/Makefile.linux --- old/sdl2-compat-2.32.58/src/Makefile.linux 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/src/Makefile.linux 2025-12-02 20:40:20.000000000 +0100 @@ -13,7 +13,7 @@ LDFLAGS+= -Wl,--no-undefined LDLIBS = -ldl -SHLIB = libSDL2-2.0.so.0.3200.58 +SHLIB = libSDL2-2.0.so.0.3200.60 OBJ = sdl2_compat.o dynapi/SDL_dynapi.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/src/sdl2_compat.c new/sdl2-compat-2.32.60/src/sdl2_compat.c --- old/sdl2-compat-2.32.58/src/sdl2_compat.c 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/src/sdl2_compat.c 2025-12-02 20:40:20.000000000 +0100 @@ -58,7 +58,7 @@ * The number might increment past 90 if there are a ton of releases. */ #define SDL2_COMPAT_VERSION_MINOR 32 -#define SDL2_COMPAT_VERSION_PATCH 58 +#define SDL2_COMPAT_VERSION_PATCH 60 #ifndef SDL2COMPAT_REVISION #define SDL2COMPAT_REVISION "SDL-2." STRINGIFY(SDL2_COMPAT_VERSION_MINOR) "." STRINGIFY(SDL2_COMPAT_VERSION_PATCH) "-no-vcs" @@ -532,9 +532,6 @@ /* SimCity 3000 tries to call SDL_DestroyMutex after we have been unloaded */ {"sc3u.dynamic", "SDL2COMPAT_NO_UNLOAD", "1"}, - - /* Hearts of Iron IV passes a garbage rwops->size pointer to SDL_LoadWAV_RW */ - {"hoi4", "SDL2COMPAT_BROKEN_LOADWAV_SIZE", "1"}, #endif }; @@ -1234,6 +1231,8 @@ static SDL2_LogOutputFunction LogOutputFunction2 = NULL; static EventFilterWrapperData *EventWatchers2 = NULL; static SDL2_bool relative_mouse_mode = SDL2_FALSE; +static float residual_motion_x = 0.0f; +static float residual_motion_y = 0.0f; static SDL_JoystickID *joystick_instance_list = NULL; static int num_joystick_instances = 0; static SDL_JoystickID *joystick_list = NULL; @@ -2286,6 +2285,11 @@ case SDL_EVENT_DROP_COMPLETE: event2->drop.windowID = event3->drop.windowID; break; + case SDL_EVENT_WINDOW_MOUSE_ENTER: + /* Reset accumulated fractional mouse data when mouse focus changes */ + residual_motion_x = 0.0f; + residual_motion_y = 0.0f; + break; case SDL_EVENT_MOUSE_MOTION: renderer = SDL3_GetRenderer(SDL3_GetWindowFromID(event3->motion.windowID)); if (renderer) { @@ -2294,7 +2298,11 @@ if (mode != SDL_LOGICAL_PRESENTATION_DISABLED) { SDL3_memcpy(&cvtevent3, event3, sizeof (SDL_Event)); SDL3_ConvertEventToRenderCoordinates(renderer, &cvtevent3); - if (!SDL3_GetBooleanProperty(SDL3_GetRendererProperties(renderer), PROP_RENDERER_RELATIVE_SCALING, true)) { + if (SDL3_GetBooleanProperty(SDL3_GetRendererProperties(renderer), PROP_RENDERER_RELATIVE_SCALING, true)) { + /* Accumulate scaled relative motion */ + residual_motion_x = SDL3_modff(residual_motion_x + cvtevent3.motion.xrel, &cvtevent3.motion.xrel); + residual_motion_y = SDL3_modff(residual_motion_y + cvtevent3.motion.yrel, &cvtevent3.motion.yrel); + } else { /* Undo the relative scaling that SDL_ConvertEventToRenderCoordinates() performed */ cvtevent3.motion.xrel = event3->motion.xrel; cvtevent3.motion.yrel = event3->motion.yrel; @@ -2889,6 +2897,7 @@ event2.window.data2 = event3->window.data2; if (event2.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { + SDL_Renderer *renderer; SDL_Window *window = SDL3_GetWindowFromID(event3->window.windowID); if (!window) { break; @@ -2897,6 +2906,18 @@ /* The size changed event has the window size, not pixel size */ SDL3_GetWindowSize(window, &event2.window.data1, &event2.window.data2); + /* SDL2 behavior is to reset the renderer viewport rect when the window is resized and + * logical presentation is disabled. + */ + renderer = SDL_GetRenderer(window); + if (renderer) { + SDL_RendererLogicalPresentation mode; + if (SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode) && + mode == SDL_LOGICAL_PRESENTATION_DISABLED) { + SDL_RenderSetViewport(renderer, NULL); + } + } + /* Fixes queue overflow with resize events that aren't processed */ { SDL_PropertiesID props = SDL3_GetWindowProperties(window); @@ -3900,12 +3921,9 @@ if (spec2 == NULL) { SDL3_InvalidParamError("spec"); } else { - SDL_IOStream *iostrm3; - if (SDL3_GetHintBoolean("SDL2COMPAT_BROKEN_LOADWAV_SIZE", false)) { - iostrm3 = RWops2to3_BrokenSize(rwops2); - } else { - iostrm3 = RWops2to3(rwops2); - } + // SDL2 didn't call the size function, so Hearts of Iron IV and Stellaris both pass in RWops structures that have garbage size pointers. + // SDL3 queries the size to prevent out of bounds loading, but can handle streams that don't implement it, so we'll just proactively prevent crashes here. + SDL_IOStream *iostrm3 = RWops2to3_BrokenSize(rwops2); if (iostrm3) { SDL_AudioSpec spec3; const bool rc = SDL3_LoadWAV_IO(iostrm3, true, &spec3, audio_buf, audio_len); /* always close the iostrm3 bridge object. */ @@ -4232,6 +4250,7 @@ SDL_ConvertSurface(SDL2_Surface *surface, const SDL2_PixelFormat *format, Uint32 flags) { SDL_Palette *palette = NULL; + SDL_PixelFormat pixel_format; SDL2_Surface *result; (void) flags; /* SDL3 removed the (unused) `flags` argument */ @@ -4245,6 +4264,14 @@ return NULL; } + // SDL2 only relied on the bpp and masks, and Dwarf Fortress doesn't fill out the format field, + // so we'll always look up the pixel format from the masks here. + pixel_format = SDL3_GetPixelFormatForMasks(format->BitsPerPixel, format->Rmask, format->Gmask, format->Bmask, format->Amask); + if (pixel_format == SDL_PIXELFORMAT_UNKNOWN) { + SDL3_InvalidParamError("format"); + return NULL; + } + if (format->palette) { // This conversion is going to assign the new surface this palette, // but it might be on the stack, so always allocate a new one to be @@ -4257,7 +4284,7 @@ SDL3_SetPaletteColors(palette, format->palette->colors, 0, ncolors); } - result = Surface3to2(SDL3_ConvertSurfaceAndColorspace(Surface2to3(surface), (SDL_PixelFormat)format->format, palette, SDL_COLORSPACE_SRGB, 0)); + result = Surface3to2(SDL3_ConvertSurfaceAndColorspace(Surface2to3(surface), pixel_format, palette, SDL_COLORSPACE_SRGB, 0)); if (palette) { SDL3_DestroyPalette(palette); @@ -6963,6 +6990,9 @@ /* These are potentially noisy and have no SDL2 equivalent */ SDL3_SetEventEnabled(SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, false); SDL3_SetEventEnabled(SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, false); + + residual_motion_x = 0.0f; + residual_motion_y = 0.0f; } if (new_flags & SDL_INIT_VIDEO) { @@ -9213,14 +9243,16 @@ } } - if (exclusive_fullscreen) { - ApplyFullscreenMode(window); - SDL3_SetWindowFullscreen(window, true); - } - if (manually_show) { - SDL3_ShowWindow(window); + if (window) { + if (exclusive_fullscreen) { + ApplyFullscreenMode(window); + SDL3_SetWindowFullscreen(window, true); + } + if (manually_show) { + SDL3_ShowWindow(window); + } + FinishWindowCreation(window); } - FinishWindowCreation(window); return window; } @@ -9285,7 +9317,9 @@ window = SDL3_CreateWindowWithProperties(props); SDL3_DestroyProperties(props); - FinishWindowCreation(window); + if (window) { + FinishWindowCreation(window); + } return window; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/src/sdl3_include_wrapper.h new/sdl2-compat-2.32.60/src/sdl3_include_wrapper.h --- old/sdl2-compat-2.32.58/src/sdl3_include_wrapper.h 2025-10-23 03:04:50.000000000 +0200 +++ new/sdl2-compat-2.32.60/src/sdl3_include_wrapper.h 2025-11-14 00:28:40.000000000 +0100 @@ -1301,6 +1301,8 @@ #define SDL_GetPenDeviceType IGNORE_THIS_VERSION_OF_SDL_GetPenDeviceType #define SDL_CreateAnimatedCursor IGNORE_THIS_VERSION_OF_SDL_CreateAnimatedCursor #define SDL_RotateSurface IGNORE_THIS_VERSION_OF_SDL_RotateSurface +#define SDL_LoadSurface_IO IGNORE_THIS_VERSION_OF_SDL_LoadSurface_IO +#define SDL_LoadSurface IGNORE_THIS_VERSION_OF_SDL_LoadSurface #define SDL_FUNCTION_POINTER_IS_VOID_POINTER 1 @@ -6399,6 +6401,14 @@ #undef SDL_RotateSurface #endif +#ifdef SDL_LoadSurface_IO +#undef SDL_LoadSurface_IO +#endif + +#ifdef SDL_LoadSurface +#undef SDL_LoadSurface +#endif + /* see at top. */ #undef SDL_ThreadID diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/src/version.rc new/sdl2-compat-2.32.60/src/version.rc --- old/sdl2-compat-2.32.58/src/version.rc 2025-10-30 18:21:40.000000000 +0100 +++ new/sdl2-compat-2.32.60/src/version.rc 2025-12-02 20:40:20.000000000 +0100 @@ -3,8 +3,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,32,58,0 - PRODUCTVERSION 2,32,58,0 + FILEVERSION 2,32,60,0 + PRODUCTVERSION 2,32,60,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -17,12 +17,12 @@ BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 32, 58, 0\0" + VALUE "FileVersion", "2, 32, 60, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer 2.0 wrapper\0" - VALUE "ProductVersion", "2, 32, 58, 0\0" + VALUE "ProductVersion", "2, 32, 60, 0\0" END END BLOCK "VarFileInfo" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/test/CMakeLists.txt new/sdl2-compat-2.32.60/test/CMakeLists.txt --- old/sdl2-compat-2.32.58/test/CMakeLists.txt 2025-10-12 20:53:05.000000000 +0200 +++ new/sdl2-compat-2.32.60/test/CMakeLists.txt 2025-11-03 21:59:56.000000000 +0100 @@ -115,14 +115,14 @@ elseif(WIN32) set(TESTNATIVE_EXTRA "testnativew32.c") elseif(UNIX AND NOT ANDROID) - if(NOT SDL2COMPAT_DISABLE_X11) + if(SDL2COMPAT_X11) find_package(X11 REQUIRED) set(TESTNATIVE_EXTRA "testnativex11.c") endif() endif() test_program(testnative SRC "testnative.c" "testutils.c" "${TESTNATIVE_EXTRA}") if(UNIX AND NOT ANDROID AND NOT APPLE) - if(NOT SDL2COMPAT_DISABLE_X11) + if(SDL2COMPAT_X11) target_link_libraries(testnative PRIVATE X11) endif() endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/test/testautomation_rect.c new/sdl2-compat-2.32.60/test/testautomation_rect.c --- old/sdl2-compat-2.32.58/test/testautomation_rect.c 2025-03-14 21:51:14.000000000 +0100 +++ new/sdl2-compat-2.32.60/test/testautomation_rect.c 2025-11-07 16:56:59.000000000 +0100 @@ -733,8 +733,8 @@ */ int rect_testIntersectRectParam(void *arg) { - SDL_Rect rectA; - SDL_Rect rectB = { 0 }; + const SDL_Rect rectA = { 0, 0, 32, 32 }; + const SDL_Rect rectB = { 0, 0, 32, 32 }; SDL_Rect result; SDL_bool intersection; @@ -988,8 +988,8 @@ */ int rect_testHasIntersectionParam(void *arg) { - SDL_Rect rectA; - SDL_Rect rectB = { 0 }; + const SDL_Rect rectA = { 0, 0, 32, 32 }; + const SDL_Rect rectB = { 0, 0, 32, 32 }; SDL_bool intersection; /* invalid parameter combinations */ @@ -1524,7 +1524,8 @@ */ int rect_testUnionRectParam(void *arg) { - SDL_Rect rectA, rectB = { 0 }; + const SDL_Rect rectA = { 0, 0, 32, 32 }; + const SDL_Rect rectB = { 0, 0, 32, 32 }; SDL_Rect result; /* invalid parameter combinations */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdl2-compat-2.32.58/test/testautomation_surface.c new/sdl2-compat-2.32.60/test/testautomation_surface.c --- old/sdl2-compat-2.32.58/test/testautomation_surface.c 2024-07-18 16:50:50.000000000 +0200 +++ new/sdl2-compat-2.32.60/test/testautomation_surface.c 2025-11-22 15:10:30.000000000 +0100 @@ -801,6 +801,56 @@ return TEST_COMPLETED; } +static int surface_testSetGetClipRect(void *args) +{ + const struct { + SDL_Rect r; + SDL_bool clipsetval; + SDL_bool cmpval; + } rect_list[] = { + { { 0, 0, 0, 0}, SDL_FALSE, SDL_TRUE}, + { { 2, 2, 0, 0}, SDL_FALSE, SDL_TRUE}, + { { 2, 2, 5, 1}, SDL_TRUE, SDL_TRUE}, + { { 6, 5, 10, 3}, SDL_TRUE, SDL_FALSE}, + { { 0, 0, 10, 10}, SDL_TRUE, SDL_TRUE}, + { { 0, 0, -10, 10}, SDL_FALSE, SDL_TRUE}, + { { 0, 0, -10, -10}, SDL_FALSE, SDL_TRUE}, + { { -10, -10, 10, 10}, SDL_FALSE, SDL_FALSE}, + { { 10, -10, 10, 10}, SDL_FALSE, SDL_FALSE}, + { { 10, 10, 10, 10}, SDL_TRUE, SDL_FALSE} + }; + SDL_Surface *s; + SDL_Rect r; + int i; + + SDLTest_AssertPass("About to call SDL_CreateRGBSurface(0, 15, 15, 32, 0, 0, 0, 0)"); + s = SDL_CreateRGBSurface(0, 15, 15, 32, 0, 0, 0, 0); + SDLTest_AssertCheck(s != NULL, "SDL_CreateRGBSurface returned non-null surface"); + SDL_zero(r); + SDL_GetClipRect(s, &r); + SDLTest_AssertCheck(r.x == 0 && r.y == 0 && r.w == 15 && r.h == 15, + "SDL_GetClipRect of just-created surface. Got {%d, %d, %d, %d}. (Expected {%d, %d, %d, %d})", + r.x, r.y, r.w, r.h, 0, 0, 15, 15); + + for (i = 0; i < SDL_arraysize(rect_list); i++) { + SDL_bool b; + const SDL_Rect *r_in = &rect_list[i].r; + SDL_Rect r_out; + + SDLTest_AssertPass("About to do SDL_SetClipRect({%d, %d, %d, %d})", r_in->x, r_in->y, r_in->w, r_in->h); + b = SDL_SetClipRect(s, r_in); + SDLTest_AssertCheck(b == rect_list[i].clipsetval, "SDL_SetClipRect returned %d (expected %d)", b, rect_list[i].clipsetval); + SDL_zero(r_out); + SDL_GetClipRect(s, &r_out); + SDLTest_AssertPass("SDL_GetClipRect returned {%d, %d, %d, %d}", r_out.x, r_out.y, r_out.w, r_out.h); + b = r_out.x == r_in->x && r_out.y == r_in->y && r_out.w == r_in->w && r_out.h == r_in->h; + SDLTest_AssertCheck(b == rect_list[i].cmpval, "Current clipping rect is identical to input clipping rect: %d (expected %d)", + b, rect_list[i].cmpval); + } + SDL_FreeSurface(s); + return TEST_COMPLETED; +}; + /* ================= Test References ================== */ /* Surface test cases */ @@ -859,11 +909,17 @@ surface_testOverflow, "surface_testOverflow", "Test overflow detection.", TEST_ENABLED }; +static const SDLTest_TestCaseReference surfaceTestSetGetClipRect = { + surface_testSetGetClipRect, "surface_testSetGetClipRect", "Test SDL_(Set|Get)ClipRect.", TEST_ENABLED +}; + /* Sequence of Surface test cases */ static const SDLTest_TestCaseReference *surfaceTests[] = { &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5, &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10, - &surfaceTest11, &surfaceTest12, &surfaceTestOverflow, NULL + &surfaceTest11, &surfaceTest12, &surfaceTestOverflow, + &surfaceTestSetGetClipRect, + NULL }; /* Surface test suite (global) */
