diff options
author | fvogel <fvogelnew1@free.fr> | 2020-01-25 16:58:35 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2020-01-25 16:58:35 (GMT) |
commit | 1dbc44fcfa39e451ced3ace1ff7f0097c0221370 (patch) | |
tree | 1ee660f12463de734a4bbf11f16f607db8758c22 /tests/bind.test | |
parent | 135b9ea56f239ca7354645cf31d4fdcbe9f99a5e (diff) | |
download | tk-1dbc44fcfa39e451ced3ace1ff7f0097c0221370.zip tk-1dbc44fcfa39e451ced3ace1ff7f0097c0221370.tar.gz tk-1dbc44fcfa39e451ced3ace1ff7f0097c0221370.tar.bz2 |
Let bind-34.3 be robust against Linux KDE hot spots on screen corners
Diffstat (limited to 'tests/bind.test')
-rw-r--r-- | tests/bind.test | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/bind.test b/tests/bind.test index 20582df..7cb515d 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6670,16 +6670,34 @@ test bind-34.2 {-warp works relatively to the screen} -setup { } -cleanup { } -result {20 20 200 200} test bind-34.3 {-warp works with null or negative coordinates} -setup { + # On some OS/WM, at least Linux with KDE, the "Screen edges" feature + # provides hot spots that can be associated with some action. + # When activated, the WM will not allow warping to happen on top of + # a hot spot (which would trigger the corresponding action as an + # unwanted effect) but will warp the pointer to the hot spot limit only. + if {[tk windowingsystem] eq "x11"} { + set halo 1 + } else { + set halo 0 + } + set res {} } -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 .] + foreach dim [winfo pointerxy .] { + if {$dim <= $halo} { + lappend res ok + } else { + lappend res $dim + } + } + event generate {} <Motion> -x 100 -y 100 -warp 1 + update idletasks ; after 50 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 + update idletasks ; after 50 foreach dim [winfo pointerxy .] { - if {$dim <= 0} { + if {$dim <= $halo} { lappend res ok } else { lappend res $dim @@ -6687,7 +6705,7 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup { } set res } -cleanup { -} -result {0 0 ok ok} +} -result {ok ok ok ok} # cleanup cleanupTests |