summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-11-26 12:55:49 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-11-26 12:55:49 (GMT)
commit135b9ea56f239ca7354645cf31d4fdcbe9f99a5e (patch)
tree625acb08c804623aca263479629ae457d08f4844 /win
parent56a928613df7230b51cd1e19f4b2922c48be5875 (diff)
downloadtk-135b9ea56f239ca7354645cf31d4fdcbe9f99a5e.zip
tk-135b9ea56f239ca7354645cf31d4fdcbe9f99a5e.tar.gz
tk-135b9ea56f239ca7354645cf31d4fdcbe9f99a5e.tar.bz2
Horrible windows-specific workaround against SendInput not moving the mouse on Win10 when both input.mi.dx and input.mi.dy are zero) - this must be a Windows bug. bind-34.3 now passes on Win10.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinPointer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index e7e041f..06cbe67 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -368,6 +368,19 @@ void TkSetCursorPos(
input.type = INPUT_MOUSE;
input.mi.dx = (x * 65535 + xscreen/2) / xscreen;
input.mi.dy = (y * 65535 + yscreen/2) / yscreen;
+
+ /*
+ * Horrible workaround here. There is a bug on Win 10: when warping to
+ * pixel (x = 0, y = 0) the SendInput() below just does not move the
+ * mouse pointer. However, as soon as dx or dy is non zero it moves as
+ * expected. Given the scaling factor of 65535 (see above),
+ * (dx = 1 , dy = 0) still means pixel (x = 0, y = 0).
+ * See ticket [69b48f427e].
+ */
+ if (input.mi.dx == 0 && input.mi.dy == 0) {
+ input.mi.dx = 1;
+ }
+
input.mi.mouseData = 0;
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = 0;