diff options
author | kjnash <k.j.nash@usa.net> | 2023-08-13 23:15:39 (GMT) |
---|---|---|
committer | kjnash <k.j.nash@usa.net> | 2023-08-13 23:15:39 (GMT) |
commit | b1ee26384532370c847c57931d985419f7f9a41f (patch) | |
tree | f594d7ab195fd5fe9de450d5d3e20b917577504e /library | |
parent | 91c5e2d32837320359eb1edb7062e73207ab8912 (diff) | |
download | tk-b1ee26384532370c847c57931d985419f7f9a41f.zip tk-b1ee26384532370c847c57931d985419f7f9a41f.tar.gz tk-b1ee26384532370c847c57931d985419f7f9a41f.tar.bz2 |
Bugfix to scaling.tcl from Csaba Nemethi, and enable rounding of ::tk::scalingPct.
Diffstat (limited to 'library')
-rw-r--r-- | library/scaling.tcl | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/library/scaling.tcl b/library/scaling.tcl index 6ff6b14..ad7832a 100644 --- a/library/scaling.tcl +++ b/library/scaling.tcl @@ -17,33 +17,25 @@ # the latter is sourced by tk.tcl. proc ::tk::ScalingPct {} { - variable doneX11ScalingInit - set pct [expr {[tk scaling] * 75}] + variable doneScalingInitX11 if {![info exists doneScalingInitX11]} { - set pct [::tk::ScalingInitX11 $pct] - set doneScalingInitX11 1 + set pct [::tk::ScalingInitX11 $pct] + set doneScalingInitX11 1 } -if 1 { - variable scalingPct - set scalingPct $pct -} else { # - # Save the value of pct rounded to the nearest multiple of 25 that is at - # least 100, in the variable scalingPct, which is used in the Widget Demo - # and should be used similarly in applications and library packages, too. - # For details, see the man page tkvars.n, shown via "man tk_scalingPct". + # Save the value of pct rounded to the nearest multiple + # of 25 that is at least 100, in the variable scalingPct. + # See "man n tk_scalingPct" for use of ::tk::scalingPct. # variable scalingPct - for {set pct2 100} {1} {incr pct2 25} { - if {$pct < $pct2 + 12.5} { - set scalingPct $pct2 - break - } + for {set scalingPct 100} {1} {incr scalingPct 25} { + if {$pct < $scalingPct + 12.5} { + break + } } -} return $pct } |