Add SDL_GetDefaultCursor.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 10:42:44 -0700
changeset 71044e4ca313000c
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
     1.1 --- a/include/SDL_mouse.h	Wed Apr 24 12:22:08 2013 -0300
     1.2 +++ b/include/SDL_mouse.h	Wed Apr 24 10:42:44 2013 -0700
     1.3 @@ -175,6 +175,11 @@
     1.4  extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
     1.5  
     1.6  /**
     1.7 + *  \brief Return the default cursor.
     1.8 + */
     1.9 +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
    1.10 +
    1.11 +/**
    1.12   *  \brief Frees a cursor created with SDL_CreateCursor().
    1.13   *  
    1.14   *  \sa SDL_CreateCursor()
     2.1 --- a/src/events/SDL_mouse.c	Wed Apr 24 12:22:08 2013 -0300
     2.2 +++ b/src/events/SDL_mouse.c	Wed Apr 24 10:42:44 2013 -0700
     2.3 @@ -626,6 +626,17 @@
     2.4      return mouse->cur_cursor;
     2.5  }
     2.6  
     2.7 +SDL_Cursor *
     2.8 +SDL_GetDefaultCursor(void)
     2.9 +{
    2.10 +    SDL_Mouse *mouse = SDL_GetMouse();
    2.11 +
    2.12 +    if (!mouse) {
    2.13 +        return NULL;
    2.14 +    }
    2.15 +    return mouse->def_cursor;
    2.16 +}
    2.17 +
    2.18  void
    2.19  SDL_FreeCursor(SDL_Cursor * cursor)
    2.20  {