mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-11 05:45:32 +00:00
Return an error if both mouse relative mode and mouse warping are unavailable, instead of asserting.
This commit is contained in:
parent
8b57331e71
commit
e401b95025
|
@ -765,9 +765,9 @@ SDL_WarpMouseGlobal(int x, int y)
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
ShouldUseRelativeModeWarp(SDL_Mouse *mouse)
|
ShouldUseRelativeModeWarp(SDL_Mouse *mouse)
|
||||||
{
|
{
|
||||||
if (!mouse->SetRelativeMouseMode) {
|
if (!mouse->WarpMouse) {
|
||||||
SDL_assert(mouse->WarpMouse); /* Need this functionality for relative mode warp implementation */
|
/* Need this functionality for relative mode warp implementation */
|
||||||
return SDL_TRUE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE);
|
return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE);
|
||||||
|
@ -796,7 +796,7 @@ SDL_SetRelativeMouseMode(SDL_bool enabled)
|
||||||
mouse->relative_mode_warp = SDL_FALSE;
|
mouse->relative_mode_warp = SDL_FALSE;
|
||||||
} else if (enabled && ShouldUseRelativeModeWarp(mouse)) {
|
} else if (enabled && ShouldUseRelativeModeWarp(mouse)) {
|
||||||
mouse->relative_mode_warp = SDL_TRUE;
|
mouse->relative_mode_warp = SDL_TRUE;
|
||||||
} else if (mouse->SetRelativeMouseMode(enabled) < 0) {
|
} else if (!mouse->SetRelativeMouseMode || mouse->SetRelativeMouseMode(enabled) < 0) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
/* Fall back to warp mode if native relative mode failed */
|
/* Fall back to warp mode if native relative mode failed */
|
||||||
if (!mouse->WarpMouse) {
|
if (!mouse->WarpMouse) {
|
||||||
|
|
Loading…
Reference in a new issue