diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-11-15 12:45:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-11-15 12:45:49 (GMT) |
commit | 8d9917ac755006729ee15fdd22e399f5861385c2 (patch) | |
tree | e8969c03014977ebf987de5ccfd62ebe2efada6d | |
parent | 15400a3c74cabbb69e7548b6dfa5812595eed24c (diff) | |
parent | 21c80c279f1a6edee55718c40818e5a3f59e1dfb (diff) | |
download | tk-8d9917ac755006729ee15fdd22e399f5861385c2.zip tk-8d9917ac755006729ee15fdd22e399f5861385c2.tar.gz tk-8d9917ac755006729ee15fdd22e399f5861385c2.tar.bz2 |
Merge 8.6
-rw-r--r-- | tests/bind.test | 19 | ||||
-rw-r--r-- | win/tkWinPointer.c | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/bind.test b/tests/bind.test index 08694f4..b0cb68a 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6749,6 +6749,25 @@ test bind-34.2 {-warp works relatively to the screen} -setup { lappend res {*}[winfo pointerxy .] } -cleanup { } -result {20 20 200 200} +test bind-34.3 {-warp works with null or negative coordinates} -setup { +} -body { + event generate {} <Motion> -x 0 -y 0 -warp 1 + update idletasks ; # DoWarp is an idle callback + after 50 ; # Win specific - wait for SendInput to be executed + set res [winfo pointerxy .] + event generate {} <Motion> -x -1 -y -1 -warp 1 + update idletasks ; # DoWarp is an idle callback + after 50 ; # Win specific - wait for SendInput to be executed + foreach dim [winfo pointerxy .] { + if {$dim <= 0} { + lappend res ok + } else { + lappend res $dim + } + } + set res +} -cleanup { +} -result {0 0 ok ok} # cleanup cleanupTests diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 2b8656b..e7e041f 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -362,8 +362,8 @@ void TkSetCursorPos( int y) { INPUT input; - unsigned xscreen = (GetSystemMetrics(SM_CXSCREEN) - 1); - unsigned yscreen = (GetSystemMetrics(SM_CYSCREEN) - 1); + int xscreen = (int)(GetSystemMetrics(SM_CXSCREEN) - 1); + int yscreen = (int)(GetSystemMetrics(SM_CYSCREEN) - 1); input.type = INPUT_MOUSE; input.mi.dx = (x * 65535 + xscreen/2) / xscreen; |