From 85a015b5206a884193bd8149f70d0305441b94e5 Mon Sep 17 00:00:00 2001 From: "J?rgen P. Tjern?" Date: Wed, 24 Apr 2013 10:42:44 -0700 Subject: [PATCH] Add SDL_GetDefaultCursor. This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1798 Thanks to Alex Szpakowski for suggestion & patch. --- include/SDL_mouse.h | 5 +++++ src/events/SDL_mouse.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index 1cfe09260..c91dfbdeb 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -174,6 +174,11 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); +/** + * \brief Return the default cursor. + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); + /** * \brief Frees a cursor created with SDL_CreateCursor(). * diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 67a143902..89ac786d2 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -626,6 +626,17 @@ SDL_GetCursor(void) return mouse->cur_cursor; } +SDL_Cursor * +SDL_GetDefaultCursor(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + if (!mouse) { + return NULL; + } + return mouse->def_cursor; +} + void SDL_FreeCursor(SDL_Cursor * cursor) {