summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-26 20:35:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-26 20:35:49 (GMT)
commiteca06f257b5b2c6a01a466e4e4501eb3f6f549a6 (patch)
tree01fdb68abd622908a5a5912c80dc60cdc90136ec /win
parent504bc5bedfd67043ba779b992162efdd5adf0302 (diff)
parent135b9ea56f239ca7354645cf31d4fdcbe9f99a5e (diff)
downloadtk-eca06f257b5b2c6a01a466e4e4501eb3f6f549a6.zip
tk-eca06f257b5b2c6a01a466e4e4501eb3f6f549a6.tar.gz
tk-eca06f257b5b2c6a01a466e4e4501eb3f6f549a6.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;