diff options
Diffstat (limited to 'library/scrlbar.tcl')
-rw-r--r-- | library/scrlbar.tcl | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 8106b3d..f545785 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -129,34 +129,11 @@ bind Scrollbar <<LineEnd>> { } } -if {[tk windowingsystem] eq "aqua"} { - bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W hv [expr {-(%D)}] - } - bind Scrollbar <Option-MouseWheel> { - tk::ScrollByUnits %W hv [expr {-10 * (%D)}] - } -} else { - # We must make sure that positive and negative movements are rounded - # equally to integers, avoiding the problem that - # (int)1/30 = 0, - # but - # (int)-1/30 = -1 - # The following code ensure equal +/- behaviour. - bind Scrollbar <MouseWheel> { - if {%D >= 0} { - tk::ScrollByUnits %W hv [expr {-%D/30}] - } else { - tk::ScrollByUnits %W hv [expr {(29-%D)/30}] - } - } +bind Scrollbar <MouseWheel> { + tk::ScrollByUnits %W hv %D -30.0 } - -if {[tk windowingsystem] eq "x11"} { - bind Scrollbar <Button-4> {tk::ScrollByUnits %W hv -5} - bind Scrollbar <Button-5> {tk::ScrollByUnits %W hv 5} - bind Scrollbar <Button-6> {tk::ScrollByUnits %W hv -5} - bind Scrollbar <Button-7> {tk::ScrollByUnits %W hv 5} +bind Scrollbar <Option-MouseWheel> { + tk::ScrollByUnits %W hv %D -3.0 } # tk::ScrollButtonDown -- @@ -329,7 +306,7 @@ proc ::tk::ScrollEndDrag {w x y} { # horizontal, "v" for vertical, "hv" for both. # amount - How many units to scroll: typically 1 or -1. -proc ::tk::ScrollByUnits {w orient amount} { +proc ::tk::ScrollByUnits {w orient amount {factor 1.0}} { set cmd [$w cget -command] if {$cmd eq "" || ([string first \ [string index [$w cget -orient] 0] $orient] < 0)} { @@ -337,9 +314,9 @@ proc ::tk::ScrollByUnits {w orient amount} { } set info [$w get] if {[llength $info] == 2} { - uplevel #0 $cmd scroll $amount units + uplevel #0 $cmd scroll [expr {$amount/$factor}] units } else { - uplevel #0 $cmd [expr {[lindex $info 2] + $amount}] + uplevel #0 $cmd [expr {[lindex $info 2] + [expr {$amount/$factor}]}] } } |