From 23fcf53c53ffada605f87cdffec5520339869b29 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 19 Oct 2025 23:03:54 -0700
Subject: [PATCH] Treat a single frame animated cursor as a normal color cursor
---
src/events/SDL_mouse.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 49b86fd96f66b..e3fa3fcec06e7 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -1636,15 +1636,19 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
}
CHECK_PARAM(!frames[0].surface) {
- SDL_SetError("Null surface in frame 0");
+ SDL_SetError("NULL surface in frame 0");
return NULL;
}
- CHECK_PARAM(!frame_count) {
+ CHECK_PARAM(frame_count <= 0) {
SDL_InvalidParamError("frame_count");
return NULL;
}
+ if (frame_count == 1) {
+ return SDL_CreateColorCursor(frames[0].surface, hot_x, hot_y);
+ }
+
// Allow specifying the hot spot via properties on the surface
SDL_PropertiesID props = SDL_GetSurfaceProperties(frames[0].surface);
hot_x = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);