Commit f9a9d3c8d4401f287d90fe6a5e5aca528ab79150

Sam Lantinga 2022-05-18T17:23:49

Also restore previous capture window if CaptureMouse() fails

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 8d97eec..e6bb096 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -1052,6 +1052,8 @@ SDL_UpdateMouseCapture(SDL_bool force_release)
             if (capture_window) {
                 capture_window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
             }
+            mouse->capture_window = previous_capture;
+
             return -1;
         }
     }