src/events/SDL_mouse.c
changeset 5405 64fa8526e1ce
parent 5376 183ec2d4485c
child 5406 1517da4ab6b1
equal deleted inserted replaced
5404:6717e01acbe0 5405:64fa8526e1ce
    40     SDL_Mouse *mouse = SDL_GetMouse();
    40     SDL_Mouse *mouse = SDL_GetMouse();
    41 
    41 
    42     mouse->cursor_shown = SDL_TRUE;
    42     mouse->cursor_shown = SDL_TRUE;
    43 
    43 
    44     return (0);
    44     return (0);
       
    45 }
       
    46 
       
    47 void
       
    48 SDL_SetDefaultCursor(SDL_Cursor * cursor)
       
    49 {
       
    50     SDL_Mouse *mouse = SDL_GetMouse();
       
    51 
       
    52     mouse->def_cursor = cursor;
       
    53     if (!mouse->cur_cursor) {
       
    54         SDL_SetCursor(cursor);
       
    55     }
    45 }
    56 }
    46 
    57 
    47 SDL_Mouse *
    58 SDL_Mouse *
    48 SDL_GetMouse(void)
    59 SDL_GetMouse(void)
    49 {
    60 {
   395     SDL_Mouse *mouse = SDL_GetMouse();
   406     SDL_Mouse *mouse = SDL_GetMouse();
   396 
   407 
   397     /* Set the new cursor */
   408     /* Set the new cursor */
   398     if (cursor) {
   409     if (cursor) {
   399         /* Make sure the cursor is still valid for this mouse */
   410         /* Make sure the cursor is still valid for this mouse */
   400         SDL_Cursor *found;
   411         if (cursor != mouse->def_cursor) {
   401         for (found = mouse->cursors; found; found = found->next) {
   412             SDL_Cursor *found;
   402             if (found == cursor) {
   413             for (found = mouse->cursors; found; found = found->next) {
   403                 break;
   414                 if (found == cursor) {
       
   415                     break;
       
   416                 }
   404             }
   417             }
   405         }
   418             if (!found) {
   406         if (!found) {
   419                 SDL_SetError("Cursor not associated with the current mouse");
   407             SDL_SetError("Cursor not associated with the current mouse");
   420                 return;
   408             return;
   421             }
   409         }
   422         }
   410         mouse->cur_cursor = cursor;
   423         mouse->cur_cursor = cursor;
   411     } else {
   424     } else {
   412         cursor = mouse->cur_cursor;
   425         cursor = mouse->cur_cursor;
   413     }
   426     }