mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
streamline boolean logic
This commit is contained in:
@@ -1607,7 +1607,7 @@ bool SDL_SetCursor(SDL_Cursor *cursor)
|
|||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
|
|
||||||
// Return immediately if setting the cursor to the currently set one (fixes #7151)
|
// already on this cursor, no further action required
|
||||||
if (cursor == mouse->cur_cursor) {
|
if (cursor == mouse->cur_cursor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1627,23 +1627,20 @@ bool SDL_SetCursor(SDL_Cursor *cursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mouse->cur_cursor = cursor;
|
mouse->cur_cursor = cursor;
|
||||||
} else {
|
} else if (mouse->focus) {
|
||||||
if (mouse->focus) {
|
|
||||||
cursor = mouse->cur_cursor;
|
cursor = mouse->cur_cursor;
|
||||||
} else {
|
} else {
|
||||||
cursor = mouse->def_cursor;
|
cursor = mouse->def_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mouse->focus && (!mouse->cursor_visible || (mouse->relative_mode && mouse->relative_mode_hide_cursor))) {
|
||||||
|
cursor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor && (!mouse->focus || (mouse->cursor_visible && (!mouse->relative_mode || !mouse->relative_mode_hide_cursor)))) {
|
|
||||||
if (mouse->ShowCursor) {
|
if (mouse->ShowCursor) {
|
||||||
mouse->ShowCursor(cursor);
|
mouse->ShowCursor(cursor);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (mouse->ShowCursor) {
|
|
||||||
mouse->ShowCursor(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user