src/events/SDL_mouse.c
changeset 7191 75360622e65f
parent 7107 2fcf7bf1d2b2
child 7493 7bfda8f0bfdf
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
   395 
   395 
   396 void
   396 void
   397 SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
   397 SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
   398 {
   398 {
   399     SDL_Mouse *mouse = SDL_GetMouse();
   399     SDL_Mouse *mouse = SDL_GetMouse();
   400 	
   400 
   401 	if ( window == NULL )
   401     if ( window == NULL )
   402 		window = mouse->focus;
   402         window = mouse->focus;
   403 	
   403 
   404 	if ( window == NULL )
   404     if ( window == NULL )
   405 		return;
   405         return;
   406 
   406 
   407     if (mouse->WarpMouse) {
   407     if (mouse->WarpMouse) {
   408         mouse->WarpMouse(window, x, y);
   408         mouse->WarpMouse(window, x, y);
   409     } else {
   409     } else {
   410         SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
   410         SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
   570     if (!mouse->CreateSystemCursor) {
   570     if (!mouse->CreateSystemCursor) {
   571         SDL_SetError("CreateSystemCursor is not currently supported");
   571         SDL_SetError("CreateSystemCursor is not currently supported");
   572         return NULL;
   572         return NULL;
   573     }
   573     }
   574 
   574 
   575 	cursor = mouse->CreateSystemCursor(id);
   575     cursor = mouse->CreateSystemCursor(id);
   576     if (cursor) {
   576     if (cursor) {
   577         cursor->next = mouse->cursors;
   577         cursor->next = mouse->cursors;
   578         mouse->cursors = cursor;
   578         mouse->cursors = cursor;
   579     }
   579     }
   580 
   580 
   581 	return cursor;
   581     return cursor;
   582 }
   582 }
   583 
   583 
   584 /* SDL_SetCursor(NULL) can be used to force the cursor redraw,
   584 /* SDL_SetCursor(NULL) can be used to force the cursor redraw,
   585    if this is desired for any reason.  This is used when setting
   585    if this is desired for any reason.  This is used when setting
   586    the video mode and when the SDL window gains the mouse focus.
   586    the video mode and when the SDL window gains the mouse focus.