Support the full set of standard CSS cursors

This commit is contained in:
Cameron Cawley 2026-05-11 19:19:07 +01:00 committed by Sam Lantinga
parent 4884dbbe56
commit e50faf4e6a
11 changed files with 391 additions and 90 deletions

View file

@ -397,6 +397,34 @@ static const char *get_active_cursor_name()
return "Window resize bottom-left";
case SDL_SYSTEM_CURSOR_W_RESIZE:
return "Window resize left";
case SDL_SYSTEM_CURSOR_CONTEXT_MENU:
return "Context menu";
case SDL_SYSTEM_CURSOR_HELP:
return "Help";
case SDL_SYSTEM_CURSOR_CELL:
return "Cell";
case SDL_SYSTEM_CURSOR_VERTICAL_TEXT:
return "Vertical text";
case SDL_SYSTEM_CURSOR_ALIAS:
return "Alias";
case SDL_SYSTEM_CURSOR_COPY:
return "Copy";
case SDL_SYSTEM_CURSOR_NO_DROP:
return "No drop";
case SDL_SYSTEM_CURSOR_GRAB:
return "Grab";
case SDL_SYSTEM_CURSOR_GRABBING:
return "Grabbing";
case SDL_SYSTEM_CURSOR_COL_RESIZE:
return "Column resize";
case SDL_SYSTEM_CURSOR_ROW_RESIZE:
return "Row resize";
case SDL_SYSTEM_CURSOR_ALL_SCROLL:
return "All scroll: Four pointed arrow pointing north, south, east, and west";
case SDL_SYSTEM_CURSOR_ZOOM_IN:
return "Zoom in";
case SDL_SYSTEM_CURSOR_ZOOM_OUT:
return "Zoom out";
default:
return "UNKNOWN CURSOR TYPE, FIX THIS PROGRAM.";
}

View file

@ -22,26 +22,40 @@ static SDLTest_CommonState *state;
static int done;
static const char *cursorNames[] = {
"arrow",
"ibeam",
"default",
"text",
"wait",
"crosshair",
"waitarrow",
"sizeNWSE",
"sizeNESW",
"sizeWE",
"sizeNS",
"sizeALL",
"NO",
"hand",
"window top left",
"window top",
"window top right",
"window right",
"window bottom right",
"window bottom",
"window bottom left",
"window left"
"progress",
"NWSE resize",
"NESW resize",
"EW resize",
"NS resize",
"move",
"not allowed",
"pointer",
"NW resize",
"N resize",
"NE resize",
"E resize",
"SE resize",
"S resize",
"SW resize",
"W resize",
"context menu",
"help",
"cell",
"vertical text",
"alias",
"copy",
"no drop",
"grab",
"grabbing",
"column resize",
"row resize",
"all scroll",
"zoom in",
"zoom out"
};
SDL_COMPILE_TIME_ASSERT(cursorNames, SDL_arraysize(cursorNames) == SDL_SYSTEM_CURSOR_COUNT);