SDL: Re-enable cursor clipping when clicking into a window when relative mouse mode is enabled

From a8ed32c5f74d282a902f5629a1398235ccec0789 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 3 Apr 2024 12:40:28 -0700
Subject: [PATCH] Re-enable cursor clipping when clicking into a window when
 relative mouse mode is enabled

---
 src/video/windows/SDL_windowsevents.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 841261d3ddcfc..00ca0bb2e4402 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -621,6 +621,18 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
                         button = SDL_BUTTON_LEFT;
                     }
                 }
+
+                if (windowdata->focus_click_pending & SDL_BUTTON(button)) {
+                    /* Ignore the button click for activation */
+                    if (!state) {
+                        windowdata->focus_click_pending &= ~SDL_BUTTON(button);
+                        WIN_UpdateClipCursor(window);
+                    }
+                    if (WIN_ShouldIgnoreFocusClick(windowdata)) {
+                        continue;
+                    }
+                }
+
                 SDL_SendMouseButton(timestamp, window, mouseID, state, button);
             }
         }