summaryrefslogtreecommitdiffstats
path: root/library/scale.tcl
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-02-25 23:13:05 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-02-25 23:13:05 (GMT)
commit02b366958959bb15d580560b7360297c330b26f7 (patch)
tree6565fb1cef886e69a1c659d4dbcd42460b360d13 /library/scale.tcl
parentc2a53df51884db85fafb3cb865da1b280bcb6e3b (diff)
downloadtk-02b366958959bb15d580560b7360297c330b26f7.zip
tk-02b366958959bb15d580560b7360297c330b26f7.tar.gz
tk-02b366958959bb15d580560b7360297c330b26f7.tar.bz2
Fix [415415fff]: Long callback: One click -> Two steps.
Diffstat (limited to 'library/scale.tcl')
-rw-r--r--library/scale.tcl17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/scale.tcl b/library/scale.tcl
index fb9b81b..acd6d75 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -210,7 +210,20 @@ proc ::tk::ScaleEndDrag {w} {
proc ::tk::ScaleIncrement {w dir big repeat} {
variable ::tk::Priv
+
if {![winfo exists $w]} return
+
+ # give the cancel callback a chance to fire if the execution time of
+ # the -command script lasts longer than -repeatdelay
+ set clockms [clock milliseconds]
+ if {$repeat eq "again" &&
+ [expr {$clockms - $Priv(clockms)}] > [expr {[$w cget -repeatinterval] * 1.1}]} {
+ set Priv(clockms) $clockms
+ set Priv(afterId) [after [$w cget -repeatinterval] \
+ [list tk::ScaleIncrement $w $dir $big again]]
+ return
+ }
+
if {$big eq "big"} {
set inc [$w cget -bigincrement]
if {$inc == 0} {
@@ -231,14 +244,18 @@ proc ::tk::ScaleIncrement {w dir big repeat} {
set inc [expr {-$inc}]
}
}
+ # this will run the -command script (if any) during the redrawing
+ # of the scale at idle time
$w set [expr {[$w get] + $inc}]
if {$repeat eq "again"} {
+ set Priv(clockms) $clockms
set Priv(afterId) [after [$w cget -repeatinterval] \
[list tk::ScaleIncrement $w $dir $big again]]
} elseif {$repeat eq "initial"} {
set delay [$w cget -repeatdelay]
if {$delay > 0} {
+ set Priv(clockms) $clockms
set Priv(afterId) [after $delay \
[list tk::ScaleIncrement $w $dir $big again]]
}