SDL_WarpMouseGlobal() should return non-void.

There are platforms it isn't implemented on (and currently can't be
implemented on!), and there's currently no way for an app to know this.

This shouldn't break ABI on apps that moved to a revision between 2.0.3 and
2.0.4.
This commit is contained in:
Ryan C. Gordon
2015-07-17 21:03:58 -04:00
parent a955bec49a
commit e346f14277
10 changed files with 25 additions and 15 deletions

View File

@@ -216,18 +216,18 @@ RPI_WarpMouse(SDL_Window * window, int x, int y)
}
/* Warp the mouse to (x,y) */
static void
static int
RPI_WarpMouseGlobal(int x, int y)
{
RPI_CursorData *curdata;
DISPMANX_UPDATE_HANDLE_T update;
int ret;
VC_RECT_T dst_rect;
SDL_Mouse *mouse = SDL_GetMouse();
if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
if (curdata->element != DISPMANX_NO_HANDLE) {
int ret;
update = vc_dispmanx_update_start( 10 );
SDL_assert( update );
vc_dispmanx_rect_set( &dst_rect, x, y, curdata->w, curdata->h);
@@ -245,8 +245,11 @@ RPI_WarpMouseGlobal(int x, int y)
/* Submit asynchronously, otherwise the peformance suffers a lot */
ret = vc_dispmanx_update_submit( update, 0, NULL );
SDL_assert( ret == DISPMANX_SUCCESS );
return (ret == DISPMANX_SUCCESS) ? 0 : -1;
}
}
return -1; /* !!! FIXME: this should SDL_SetError() somewhere. */
}
void