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 <mlevedahl@gmail.com>

Mark Levedahl committed Jul 6, 2024 at 13:12 UTC 3489ff17e2861d83407e215224f8654cd8671135
1 file changed +11 -10
gitk
+11 -10
@@ -2698,7 +2698,7 @@ proc makewindow {} {
2698 if {[tk windowingsystem] == "win32"} {
2699 bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
2700 bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }
2701 - } else {
2701 + } elseif {[tk windowingsystem] == "x11"} {
2702 bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
2703 bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
2704 bind $ctext <Button> {
@@ -2708,16 +2708,17 @@ proc makewindow {} {
2708 $ctext xview scroll 5 units
2709 }
2710 }
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
2715 }
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"]
2722 }
2723 bindall <$::BM> "canvscan mark %W %x %y"
2724 bindall <B$::BM-Motion> "canvscan dragto %W %x %y"