Skip to content

Commit 23fcf53

Browse files
committed
Treat a single frame animated cursor as a normal color cursor
1 parent bd86e85 commit 23fcf53

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/events/SDL_mouse.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,15 +1636,19 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
16361636
}
16371637

16381638
CHECK_PARAM(!frames[0].surface) {
1639-
SDL_SetError("Null surface in frame 0");
1639+
SDL_SetError("NULL surface in frame 0");
16401640
return NULL;
16411641
}
16421642

1643-
CHECK_PARAM(!frame_count) {
1643+
CHECK_PARAM(frame_count <= 0) {
16441644
SDL_InvalidParamError("frame_count");
16451645
return NULL;
16461646
}
16471647

1648+
if (frame_count == 1) {
1649+
return SDL_CreateColorCursor(frames[0].surface, hot_x, hot_y);
1650+
}
1651+
16481652
// Allow specifying the hot spot via properties on the surface
16491653
SDL_PropertiesID props = SDL_GetSurfaceProperties(frames[0].surface);
16501654
hot_x = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);

0 commit comments

Comments
 (0)