SDL: Show the cursor when relative mode is enabled and the app doesn't have focus

From 44f66b5c8bc835aff0cd695e2b5e3848b9480803 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 10 Jun 2024 14:56:16 -0700
Subject: [PATCH] Show the cursor when relative mode is enabled and the app
 doesn't have focus

Testing:
* Run test/testwm
* Hit Ctrl-R to toggle relative mode
* Alt-tab away
* Move the mouse over testwm
* Note that the cursor is visible until testwm gains focus
---
 src/events/SDL_mouse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 832173cd73e0b..476959eccc53c 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -1541,7 +1541,7 @@ int SDL_SetCursor(SDL_Cursor *cursor)
         }
     }
 
-    if (cursor && mouse->cursor_shown && !mouse->relative_mode) {
+    if (cursor && (!mouse->focus || (mouse->cursor_shown && !mouse->relative_mode))) {
         if (mouse->ShowCursor) {
             mouse->ShowCursor(cursor);
         }