Skip to content

Commit

Permalink
Fix for bug [d1a5067111], related to the TouchpadScroll event bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
csaba committed Jul 17, 2024
1 parent 6c40142 commit 52aa91a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions library/listbox.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ bind Listbox <TouchpadScroll> {
if {%# %% 5 != 0} {
return
}
lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
if {$tk::Priv::deltaX != 0} {
%W xview scroll [expr {-$tk::Priv::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 {$tk::Priv::deltaY != 0} {
%W yview scroll [expr {-$tk::Priv::deltaY}] units
if {$tk::Priv(deltaY) != 0} {
%W yview scroll [expr {-$tk::Priv(deltaY)}] units
}
}

Expand Down
10 changes: 5 additions & 5 deletions library/scrlbar.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ bind Scrollbar <Shift-Option-MouseWheel> {
tk::ScrollByUnits %W hv %D -12.0
}
bind Scrollbar <TouchpadScroll> {
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
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 {$tk::Priv::deltaY != 0 && [%W cget -orient] eq "vertical"} {
tk::ScrollbarScrollByPixels %W v $tk::Priv::deltaY
if {$tk::Priv(deltaY) != 0 && [%W cget -orient] eq "vertical"} {
tk::ScrollbarScrollByPixels %W v $tk::Priv(deltaY)
}
}

Expand Down
10 changes: 5 additions & 5 deletions library/text.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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] tk::Priv::deltaX tk::Priv::deltaY
if {$tk::Priv::deltaX != 0} {
%W xview scroll [tk::ScaleNum [expr {-$tk::Priv::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 {$tk::Priv::deltaY != 0} {
%W yview scroll [tk::ScaleNum [expr {-$tk::Priv::deltaY}]] pixels
if {$tk::Priv(deltaY) != 0} {
%W yview scroll [tk::ScaleNum [expr {-$tk::Priv(deltaY)}]] pixels
}
}

Expand Down
6 changes: 3 additions & 3 deletions library/ttk/combobox.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ bind TCombobox <Shift-MouseWheel> {
# Ignore the event
}
bind TCombobox <TouchpadScroll> {
lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
lassign [tk::PreciseScrollDeltas %D] tk::Priv(deltaX) tk::Priv(deltaY)
# TouchpadScroll events fire about 60 times per second.
if {$tk::Priv::deltaY != 0 && %# %% 15 == 0} {
ttk::combobox::Scroll %W [expr {$tk::Priv::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 }
Expand Down
6 changes: 3 additions & 3 deletions library/ttk/spinbox.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ bind TSpinbox <Shift-MouseWheel> {
# Ignore the event
}
bind TSpinbox <TouchpadScroll> {
lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
lassign [tk::PreciseScrollDeltas %D] tk::Priv(deltaX) tk::Priv(deltaY)
# TouchpadScroll events fire about 60 times per second.
if {$tk::Priv::deltaY != 0 && %# %% 12 == 0} {
ttk::spinbox::Spin %W [expr {$tk::Priv::deltaY > 0 ? -1 : 1}]
if {$tk::Priv(deltaY) != 0 && %# %% 12 == 0} {
ttk::spinbox::Spin %W [expr {$tk::Priv(deltaY) > 0 ? -1 : 1}]
}
}

Expand Down
10 changes: 5 additions & 5 deletions library/ttk/utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ bind TtkScrollable <TouchpadScroll> {
if {%# %% 5 != 0} {
return
}
lassign [tk::PreciseScrollDeltas %D] tk::Priv::deltaX tk::Priv::deltaY
if {$tk::Priv::deltaX != 0} {
%W xview scroll [expr {-$tk::Priv::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 {$tk::Priv::deltaY != 0} {
%W yview scroll [expr {-$tk::Priv::deltaY}] units
if {$tk::Priv(deltaY) != 0} {
%W yview scroll [expr {-$tk::Priv(deltaY)}] units
}
}
#*EOF*

0 comments on commit 52aa91a

Please sign in to comment.