Add SDL_GetDefaultCursor.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 10:42:44 -0700
changeset 7104 4e4ca313000c
parent 7103 9d146930d4f2
child 7105 0de0f099cfd6
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
src/events/SDL_mouse.c
--- a/include/SDL_mouse.h	Wed Apr 24 12:22:08 2013 -0300
+++ b/include/SDL_mouse.h	Wed Apr 24 10:42:44 2013 -0700
@@ -175,6 +175,11 @@
 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().
  *  
  *  \sa SDL_CreateCursor()
--- a/src/events/SDL_mouse.c	Wed Apr 24 12:22:08 2013 -0300
+++ b/src/events/SDL_mouse.c	Wed Apr 24 10:42:44 2013 -0700
@@ -626,6 +626,17 @@
     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)
 {