diff options
author | fvogel <fvogelnew1@free.fr> | 2019-10-11 20:23:14 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2019-10-11 20:23:14 (GMT) |
commit | a855bc82aa673d34a0f518c1726681a53d128b93 (patch) | |
tree | d8913695af5e5657c5cccdefff74b094e4abbf74 /win/tkWinPointer.c | |
parent | e26964faffb55027390e431942fbbd69a52dcf43 (diff) | |
download | tk-a855bc82aa673d34a0f518c1726681a53d128b93.zip tk-a855bc82aa673d34a0f518c1726681a53d128b93.tar.gz tk-a855bc82aa673d34a0f518c1726681a53d128b93.tar.bz2 |
Cherrypick [8f767ecb] Leaf: Let's do exactly the same calculation, but then using integer arithmetics instead of float
Diffstat (limited to 'win/tkWinPointer.c')
-rw-r--r-- | win/tkWinPointer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 14e96c8..2b8656b 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -362,10 +362,12 @@ void TkSetCursorPos( int y) { INPUT input; + unsigned xscreen = (GetSystemMetrics(SM_CXSCREEN) - 1); + unsigned yscreen = (GetSystemMetrics(SM_CYSCREEN) - 1); input.type = INPUT_MOUSE; - input.mi.dx = (LONG)(x * (65535.0 / (GetSystemMetrics(SM_CXSCREEN) - 1)) + 0.5); - input.mi.dy = (LONG)(y * (65535.0 / (GetSystemMetrics(SM_CYSCREEN) - 1)) + 0.5); + input.mi.dx = (x * 65535 + xscreen/2) / xscreen; + input.mi.dy = (y * 65535 + yscreen/2) / yscreen; input.mi.mouseData = 0; input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = 0; |