From 105e467aa6d338f562e9b8c4303afd887a7de35d Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 31 Mar 2025 14:35:18 -0400
Subject: [PATCH] SDL_SetWindowIcon: Clear error string after calling into
SDL3.
py-sdl2's tests are checking the string because in SDL2, this function returns
void. This check is incorrect, but it's trivial to make this match SDL2
behavior.
In SDL3, this function returns an error, and on some platforms (like Wayland
without support for the xdg_toplevel_icon_v1 protocol, etc), this will report
failure and set the error string, legitimately.
Fixes #443.
---
src/sdl2_compat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 4cc8e3a..a95beaf 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -9111,6 +9111,7 @@ SDL_DECLSPEC void SDLCALL
SDL_SetWindowIcon(SDL_Window *window, SDL2_Surface *icon)
{
SDL3_SetWindowIcon(window, Surface2to3(icon));
+ SDL3_ClearError(); // py-sdl2's test suite checks the error string here incorrectly, so clear it.
}
SDL_DECLSPEC void SDLCALL