summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsaba <csaba>2024-07-15 18:25:49 (GMT)
committercsaba <csaba>2024-07-15 18:25:49 (GMT)
commitd7fe315ae745fed3291cce3ebd388cda58c24b07 (patch)
tree40ebf82555ee197d739ded183623a3414966a88c
parent647e17558e1634fb15bc5982a03e0ee50c46ee53 (diff)
downloadtk-d7fe315ae745fed3291cce3ebd388cda58c24b07.zip
tk-d7fe315ae745fed3291cce3ebd388cda58c24b07.tar.gz
tk-d7fe315ae745fed3291cce3ebd388cda58c24b07.tar.bz2
Made sure that the TouchpadScroll event bindings won't polluate the global namespace (thanks to Rolf Ade for triggering this improvement).
-rw-r--r--library/listbox.tcl12
-rw-r--r--library/scrlbar.tcl10
-rw-r--r--library/text.tcl10
-rw-r--r--library/ttk/combobox.tcl6
-rw-r--r--library/ttk/spinbox.tcl6
-rw-r--r--library/ttk/utils.tcl10
6 files changed, 27 insertions, 27 deletions
diff --git a/library/listbox.tcl b/library/listbox.tcl
index d611801..e229caf 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -14,7 +14,7 @@
# tk::Priv elements used in this file:
#
# afterId - Token returned by "after" for autoscanning.
-# listboxPrev - The last element to be selected or deselected
+# listboxPrev - The last element to be selected or deselected
# during a selection operation.
# listboxSelection - All of the items that were selected before the
# current selection operation (such as a mouse
@@ -191,12 +191,12 @@ bind Listbox <TouchpadScroll> {
if {%# %% 5 != 0} {
return
}
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
- if {$deltaX != 0} {
- %W xview scroll [expr {-$deltaX}] units
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
+ if {$tk::Priv::deltaX != 0} {
+ %W xview scroll [expr {-$tk::Priv::deltaX}] units
}
- if {$deltaY != 0} {
- %W yview scroll [expr {-$deltaY}] units
+ if {$tk::Priv::deltaY != 0} {
+ %W yview scroll [expr {-$tk::Priv::deltaY}] units
}
}
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index 9e210f6..fd44f10 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -145,12 +145,12 @@ bind Scrollbar <Shift-Option-MouseWheel> {
tk::ScrollByUnits %W hv %D -12.0
}
bind Scrollbar <TouchpadScroll> {
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
- if {$deltaX != 0 && [%W cget -orient] eq "horizontal"} {
- tk::ScrollbarScrollByPixels %W h $deltaX
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
+ if {$tk::Priv::deltaX != 0 && [%W cget -orient] eq "horizontal"} {
+ tk::ScrollbarScrollByPixels %W h $tk::Priv::deltaX
}
- if {$deltaY != 0 && [%W cget -orient] eq "vertical"} {
- tk::ScrollbarScrollByPixels %W v $deltaY
+ if {$tk::Priv::deltaY != 0 && [%W cget -orient] eq "vertical"} {
+ tk::ScrollbarScrollByPixels %W v $tk::Priv::deltaY
}
}
diff --git a/library/text.tcl b/library/text.tcl
index 15bdef2..5003ade 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -469,12 +469,12 @@ bind Text <Shift-Option-MouseWheel> {
tk::MouseWheel %W x [tk::ScaleNum %D] -1.2 pixels
}
bind Text <TouchpadScroll> {
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
- if {$deltaX != 0} {
- %W xview scroll [tk::ScaleNum [expr {-$deltaX}]] pixels
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
+ if {$tk::Priv::deltaX != 0} {
+ %W xview scroll [tk::ScaleNum [expr {-$tk::Priv::deltaX}]] pixels
}
- if {$deltaY != 0} {
- %W yview scroll [tk::ScaleNum [expr {-$deltaY}]] pixels
+ if {$tk::Priv::deltaY != 0} {
+ %W yview scroll [tk::ScaleNum [expr {-$tk::Priv::deltaY}]] pixels
}
}
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 1b9d4cb..649cbd0 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -57,10 +57,10 @@ bind TCombobox <Shift-MouseWheel> {
# Ignore the event
}
bind TCombobox <TouchpadScroll> {
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
# TouchpadScroll events fire about 60 times per second.
- if {$deltaY != 0 && %# %% 15 == 0} {
- ttk::combobox::Scroll %W [expr {$deltaY > 0 ? -1 : 1}]
+ if {$tk::Priv::deltaY != 0 && %# %% 15 == 0} {
+ ttk::combobox::Scroll %W [expr {$tk::Priv::deltaY > 0 ? -1 : 1}]
}
}
bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 96d8acf..c865795 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -28,10 +28,10 @@ bind TSpinbox <Shift-MouseWheel> {
# Ignore the event
}
bind TSpinbox <TouchpadScroll> {
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
# TouchpadScroll events fire about 60 times per second.
- if {$deltaY != 0 && %# %% 12 == 0} {
- ttk::spinbox::Spin %W [expr {$deltaY > 0 ? -1 : 1}]
+ if {$tk::Priv::deltaY != 0 && %# %% 12 == 0} {
+ ttk::spinbox::Spin %W [expr {$tk::Priv::deltaY > 0 ? -1 : 1}]
}
}
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index 3f6446d..4b49ae0 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -307,12 +307,12 @@ bind TtkScrollable <TouchpadScroll> {
if {%# %% 5 != 0} {
return
}
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
- if {$deltaX != 0} {
- %W xview scroll [expr {-$deltaX}] units
+ lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
+ if {$tk::Priv::deltaX != 0} {
+ %W xview scroll [expr {-$tk::Priv::deltaX}] units
}
- if {$deltaY != 0} {
- %W yview scroll [expr {-$deltaY}] units
+ if {$tk::Priv::deltaY != 0} {
+ %W yview scroll [expr {-$tk::Priv::deltaY}] units
}
}
#*EOF*