SDL: Updating the mouse capture should use the mouse focus window

From e54001b02809dcebbb822bd0297919c8c76976a1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 3 Mar 2024 11:32:17 -0800
Subject: [PATCH] Updating the mouse capture should use the mouse focus window

Fixes https://github.com/libsdl-org/SDL/issues/8974
---
 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 0d5e67bb74ce..c7cf857cb491 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -1163,7 +1163,7 @@ int SDL_UpdateMouseCapture(SDL_bool force_release)
         if (SDL_GetMessageBoxCount() == 0 &&
             (mouse->capture_desired || (mouse->auto_capture && GetButtonState(mouse, SDL_FALSE) != 0))) {
             if (!mouse->relative_mode) {
-                capture_window = SDL_GetKeyboardFocus();
+                capture_window = mouse->focus;
             }
         }
     }