Also restore previous capture window if CaptureMouse() fails
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;
}
}