src/events/SDL_mouse.c
changeset 5405 64fa8526e1ce
parent 5376 183ec2d4485c
child 5406 1517da4ab6b1
     1.1 --- a/src/events/SDL_mouse.c	Sun Feb 27 21:17:06 2011 -0800
     1.2 +++ b/src/events/SDL_mouse.c	Sun Feb 27 21:36:23 2011 -0800
     1.3 @@ -44,6 +44,17 @@
     1.4      return (0);
     1.5  }
     1.6  
     1.7 +void
     1.8 +SDL_SetDefaultCursor(SDL_Cursor * cursor)
     1.9 +{
    1.10 +    SDL_Mouse *mouse = SDL_GetMouse();
    1.11 +
    1.12 +    mouse->def_cursor = cursor;
    1.13 +    if (!mouse->cur_cursor) {
    1.14 +        SDL_SetCursor(cursor);
    1.15 +    }
    1.16 +}
    1.17 +
    1.18  SDL_Mouse *
    1.19  SDL_GetMouse(void)
    1.20  {
    1.21 @@ -397,15 +408,17 @@
    1.22      /* Set the new cursor */
    1.23      if (cursor) {
    1.24          /* Make sure the cursor is still valid for this mouse */
    1.25 -        SDL_Cursor *found;
    1.26 -        for (found = mouse->cursors; found; found = found->next) {
    1.27 -            if (found == cursor) {
    1.28 -                break;
    1.29 +        if (cursor != mouse->def_cursor) {
    1.30 +            SDL_Cursor *found;
    1.31 +            for (found = mouse->cursors; found; found = found->next) {
    1.32 +                if (found == cursor) {
    1.33 +                    break;
    1.34 +                }
    1.35              }
    1.36 -        }
    1.37 -        if (!found) {
    1.38 -            SDL_SetError("Cursor not associated with the current mouse");
    1.39 -            return;
    1.40 +            if (!found) {
    1.41 +                SDL_SetError("Cursor not associated with the current mouse");
    1.42 +                return;
    1.43 +            }
    1.44          }
    1.45          mouse->cur_cursor = cursor;
    1.46      } else {