diff options
-rw-r--r-- | library/scrlbar.tcl | 4 | ||||
-rw-r--r-- | tests/scrollbar.test | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index b1658ac..b7be014 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -153,10 +153,10 @@ switch [tk windowingsystem] { } "x11" { bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W v [expr {- (%D /120 )}] + tk::ScrollByUnits %W v [expr {- (%D /120 ) * 4}] } bind Scrollbar <Shift-MouseWheel> { - tk::ScrollByUnits %W h [expr {- (%D /120 )}] + tk::ScrollByUnits %W h [expr {- (%D /120 ) * 4}] } bind Scrollbar <4> {tk::ScrollByUnits %W v -5} bind Scrollbar <5> {tk::ScrollByUnits %W v 5} diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 8f92c93..6717deb 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -632,7 +632,7 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} { list [winfo children .] [interp hidden] } [list {} $l] -test scrollbar-10.1 {<MouseWheel> event on scrollbar} -constraints win -setup { +test scrollbar-10.1 {<MouseWheel> event on scrollbar} -setup { destroy .t .s } -body { pack [text .t -yscrollcommand {.s set}] -side left @@ -647,6 +647,21 @@ test scrollbar-10.1 {<MouseWheel> event on scrollbar} -constraints win -setup { destroy .t .s } -result {2.0} +test scrollbar-10.2 {<MouseWheel> event on scrollbar} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set}] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <Shift-MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {2.0} + catch {destroy .s} catch {destroy .t} |