summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2023-11-28 03:38:54 (GMT)
committermarc_culler <marc.culler@gmail.com>2023-11-28 03:38:54 (GMT)
commit9c14936e2980f87eafc2b80694de4f73abf9ebc0 (patch)
tree3c86d0317e944738dd8ced84210c185df01501eb /library/ttk
parent1b1276420e9016d6eddf1cfc49642a0ffcf3535f (diff)
downloadtk-9c14936e2980f87eafc2b80694de4f73abf9ebc0.zip
tk-9c14936e2980f87eafc2b80694de4f73abf9ebc0.tar.gz
tk-9c14936e2980f87eafc2b80694de4f73abf9ebc0.tar.bz2
Add bindings for listbox and treeview. Some code clean up.
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/utils.tcl14
1 files changed, 14 insertions, 0 deletions
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index c2c7e8f..32c119d 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -301,4 +301,18 @@ bind TtkScrollable <Shift-MouseWheel> \
bind TtkScrollable <Shift-Option-MouseWheel> \
{ tk::MouseWheel %W x %D -12.0 }
+## Touchpad scrolling
+#
+bind TtkScrollable <TouchpadScroll> {
+ if {[expr {%# %% 4}] != 0} {
+ return
+ }
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ if {$deltaX != 0} {
+ %W xview scroll [expr {-$deltaX}] units
+ }
+ if {$deltaY != 0} {
+ %W yview scroll [expr {-$deltaY}] units
+ }
+}
#*EOF*