Skip to content

Commit 3489ff1

Browse files
committed
gitk: separate x11 / win32 / aqua Mouse bindings
Tk through 8.6 has different approaches for handling mouse wheel / touchpad scrolling events on the different platforms, and gitk has separate code for these. But, some x11 bindings are applied on aqua as we do not have these in a clean if / then / else tree based upon platform. Let's split these bindings apart. Signed-off-by: Mark Levedahl <[email protected]>
1 parent 51bb2ab commit 3489ff1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

gitk

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,7 @@ proc makewindow {} {
26982698
if {[tk windowingsystem] == "win32"} {
26992699
bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
27002700
bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }
2701-
} else {
2701+
} elseif {[tk windowingsystem] == "x11"} {
27022702
bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
27032703
bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
27042704
bind $ctext <Button> {
@@ -2708,16 +2708,17 @@ proc makewindow {} {
27082708
$ctext xview scroll 5 units
27092709
}
27102710
}
2711-
if {[tk windowingsystem] eq "aqua"} {
2712-
bindall <MouseWheel> {
2713-
set delta [expr {- (%D)}]
2714-
allcanvs yview scroll $delta units
2715-
}
2716-
bindall <Shift-MouseWheel> {
2717-
set delta [expr {- (%D)}]
2718-
$canv xview scroll $delta units
2719-
}
2711+
} elseif {[tk windowingsystem] == "aqua"} {
2712+
bindall <MouseWheel> {
2713+
set delta [expr {- (%D)}]
2714+
allcanvs yview scroll $delta units
27202715
}
2716+
bindall <Shift-MouseWheel> {
2717+
set delta [expr {- (%D)}]
2718+
$canv xview scroll $delta units
2719+
}
2720+
} else {
2721+
puts stderr [mc "Unknown windowing system, cannot bind mouse"]
27212722
}
27222723
bindall <$::BM> "canvscan mark %W %x %y"
27232724
bindall <B$::BM-Motion> "canvscan dragto %W %x %y"

0 commit comments

Comments
 (0)