From f688889b413d966b0e1894755ebe7678709671fd Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 20 Feb 2020 01:44:45 +0000 Subject: [PATCH] [d3d9] Avoid setting cursor position if we are already at that position Avoids an infinite loop where we trigger the cursor move window message which calls SetCursorPos and so on and so forth... Closes #1400 --- src/d3d9/d3d9_cursor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/d3d9/d3d9_cursor.cpp b/src/d3d9/d3d9_cursor.cpp index ad3903d0..408268c1 100644 --- a/src/d3d9/d3d9_cursor.cpp +++ b/src/d3d9/d3d9_cursor.cpp @@ -1,10 +1,15 @@ #include "d3d9_cursor.h" +#include "d3d9_util.h" #include namespace dxvk { void D3D9Cursor::UpdateCursor(int X, int Y) { + POINT currentPos = { }; + if (::GetCursorPos(¤tPos) && currentPos == POINT{ X, Y }) + return; + ::SetCursorPos(X, Y); }