From 14429e2b23cc290f7ce55d154b0190bdc6b99541 Mon Sep 17 00:00:00 2001 From: Juliano Leal Goncalves Date: Sat, 5 Jun 2021 22:17:27 -0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Leverage=20'Point'=20to=20?= =?UTF-8?q?represent=20mouse=20position=20warping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/miniwin/misc_msg.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/miniwin/misc_msg.cpp b/Source/miniwin/misc_msg.cpp index 81ce6b115..b6cc40e08 100644 --- a/Source/miniwin/misc_msg.cpp +++ b/Source/miniwin/misc_msg.cpp @@ -35,13 +35,11 @@ namespace devilution { static std::deque message_queue; bool mouseWarping = false; -int mouseWarpingX; -int mouseWarpingY; +Point mousePositionWarping; void SetCursorPos(int x, int y) { - mouseWarpingX = x; - mouseWarpingY = y; + mousePositionWarping = { x, y }; mouseWarping = true; LogicalToOutput(&x, &y); SDL_WarpMouseInWindow(ghMainWnd, x, y); @@ -562,7 +560,7 @@ bool FetchMessage(tagMSG *lpMsg) // and SDL_GetMouseState gives previous location if mouse was // outside window (observed on Ubuntu 19.04) if (mouseWarping) { - MousePosition = { mouseWarpingX, mouseWarpingY }; + MousePosition = mousePositionWarping; mouseWarping = false; } break;