summaryrefslogtreecommitdiffstats
path: root/library/scrlbar.tcl
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-16 14:51:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-16 14:51:22 (GMT)
commit64be854d97cacfa743144a08a60b4ea3b74b484a (patch)
treef270f41b6867df85fc605debdef26195edff24ae /library/scrlbar.tcl
parent4875d4135079ccec5bf1e4e60a5b6a835dbc8602 (diff)
downloadtk-64be854d97cacfa743144a08a60b4ea3b74b484a.zip
tk-64be854d97cacfa743144a08a60b4ea3b74b484a.tar.gz
tk-64be854d97cacfa743144a08a60b4ea3b74b484a.tar.bz2
Refactor all MouseWheel bindings, doing it the same way everywhere. So <MouseWheel> bindings are there on all platforms, (Button-4|5) only on X11.
Also add bindings for vertical scrolling for iconlist, as suggested by Max Augsburg. (still to be tested on X11 and MacOS)
Diffstat (limited to 'library/scrlbar.tcl')
-rw-r--r--library/scrlbar.tcl58
1 files changed, 26 insertions, 32 deletions
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index 6f1caa2..65f29ee 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -128,42 +128,36 @@ bind Scrollbar <<LineEnd>> {
tk::ScrollToPos %W 1
}
}
-switch [tk windowingsystem] {
- "aqua" {
- bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W v [expr {- (%D)}]
- }
- bind Scrollbar <Option-MouseWheel> {
- tk::ScrollByUnits %W v [expr {-10 * (%D)}]
- }
- bind Scrollbar <Shift-MouseWheel> {
- tk::ScrollByUnits %W h [expr {- (%D)}]
- }
- bind Scrollbar <Shift-Option-MouseWheel> {
- tk::ScrollByUnits %W h [expr {-10 * (%D)}]
- }
+
+if {[tk windowingsystem] eq "aqua"} {
+ bind Scrollbar <MouseWheel> {
+ tk::ScrollByUnits %W v [expr {-(%D)}]
}
- "win32" {
- bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W v [expr {- (%D / 120) * 4}]
- }
- bind Scrollbar <Shift-MouseWheel> {
- tk::ScrollByUnits %W h [expr {- (%D / 120) * 4}]
- }
+ bind Scrollbar <Option-MouseWheel> {
+ tk::ScrollByUnits %W v [expr {-10 * (%D)}]
}
- "x11" {
- bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W v [expr {- (%D /120 ) * 4}]
- }
- bind Scrollbar <Shift-MouseWheel> {
- tk::ScrollByUnits %W h [expr {- (%D /120 ) * 4}]
- }
- bind Scrollbar <4> {tk::ScrollByUnits %W v -5}
- bind Scrollbar <5> {tk::ScrollByUnits %W v 5}
- bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5}
- bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5}
+ bind Scrollbar <Shift-MouseWheel> {
+ tk::ScrollByUnits %W h [expr {-(%D)}]
+ }
+ bind Scrollbar <Shift-Option-MouseWheel> {
+ tk::ScrollByUnits %W h [expr {-10 * (%D)}]
+ }
+} else {
+ bind Scrollbar <MouseWheel> {
+ tk::ScrollByUnits %W v [expr {-(%D / 30)}]
+ }
+ bind Scrollbar <Shift-MouseWheel> {
+ tk::ScrollByUnits %W h [expr {-(%D / 30)}]
}
}
+
+if {[tk windowingsystem] eq "x11"} {
+ bind Scrollbar <4> {tk::ScrollByUnits %W v -5}
+ bind Scrollbar <5> {tk::ScrollByUnits %W v 5}
+ bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5}
+ bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5}
+}
+
# tk::ScrollButtonDown --
# This procedure is invoked when a button is pressed in a scrollbar.
# It changes the way the scrollbar is displayed and takes actions