If there isn't a GetGlobalMouseState() implementation, fall back to the normal one.

This commit is contained in:
Sam Lantinga
2020-05-26 16:34:50 -07:00
parent 437577f91e
commit bcbaa4ec1f
3 changed files with 16 additions and 35 deletions

View File

@@ -722,23 +722,24 @@ Uint32
SDL_GetGlobalMouseState(int *x, int *y)
{
SDL_Mouse *mouse = SDL_GetMouse();
int tmpx, tmpy;
/* make sure these are never NULL for the backend implementations... */
if (!x) {
x = &tmpx;
if (mouse->GetGlobalMouseState) {
int tmpx, tmpy;
/* make sure these are never NULL for the backend implementations... */
if (!x) {
x = &tmpx;
}
if (!y) {
y = &tmpy;
}
*x = *y = 0;
return mouse->GetGlobalMouseState(x, y);
} else {
return SDL_GetMouseState(x, y);
}
if (!y) {
y = &tmpy;
}
*x = *y = 0;
if (!mouse->GetGlobalMouseState) {
return 0;
}
return mouse->GetGlobalMouseState(x, y);
}
void