summaryrefslogtreecommitdiffstats
path: root/win/tkWinPointer.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-08-22 15:38:34 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-08-22 15:38:34 (GMT)
commitcdc9ded607b1d18a5901761fc49385932471605d (patch)
tree99885fe0a453814f7438ce6c8811a004f7211364 /win/tkWinPointer.c
parent56f9690a29e9307a87d15b93cee4f09ce3111407 (diff)
downloadtk-cdc9ded607b1d18a5901761fc49385932471605d.zip
tk-cdc9ded607b1d18a5901761fc49385932471605d.tar.gz
tk-cdc9ded607b1d18a5901761fc49385932471605d.tar.bz2
Fix maths in TkSetCursorPos(). I have checked that this implementation provides the same results as SetCursorPos (that we don't use anymore). That checking has included the multiple monitors and negative coordinates cases.
Diffstat (limited to 'win/tkWinPointer.c')
-rw-r--r--win/tkWinPointer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index 55fa35e..8ab512c 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -352,7 +352,7 @@ XQueryPointer(
/*
* TkSetCursorPos is a helper function replacing SetCursorPos since this
- * latter Windows function appears the have been broken by Microsoft
+ * latter Windows function appears to have been broken by Microsoft
* since Win10 Falls Creator Update - See ticket [69b48f427e] along with
* several other Internet reports about this breakage.
*/
@@ -364,8 +364,8 @@ void TkSetCursorPos(
INPUT input;
input.type = INPUT_MOUSE;
- input.mi.dx = x * (65536.0 / GetSystemMetrics(SM_CXSCREEN));
- input.mi.dy = y * (65536.0 / GetSystemMetrics(SM_CYSCREEN));
+ input.mi.dx = x * (65535.0 / (GetSystemMetrics(SM_CXSCREEN) - 1));
+ input.mi.dy = y * (65535.0 / (GetSystemMetrics(SM_CYSCREEN) - 1));
input.mi.mouseData = 0;
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = 0;