]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: separate x11 / win32 / aqua Mouse bindings
authorMark Levedahl <mlevedahl@gmail.com>
Sat, 6 Jul 2024 17:12:01 +0000 (13:12 -0400)
committerMark Levedahl <mlevedahl@gmail.com>
Thu, 17 Jul 2025 03:01:51 +0000 (23:01 -0400)
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>
gitk

diff --git a/gitk b/gitk
index a80aea9a48a85a962537f7e6cc580d024c6a19e2..8b3476c5160d2ce7c17be76916a38e8bfc10f7d4 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -2698,7 +2698,7 @@ proc makewindow {} {
     if {[tk windowingsystem] == "win32"} {
         bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
         bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }
-    } else {
+    } elseif {[tk windowingsystem] == "x11"} {
         bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
         bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
         bind $ctext <Button> {
@@ -2708,16 +2708,17 @@ proc makewindow {} {
                 $ctext xview scroll 5 units
             }
         }
-        if {[tk windowingsystem] eq "aqua"} {
-            bindall <MouseWheel> {
-                set delta [expr {- (%D)}]
-                allcanvs yview scroll $delta units
-            }
-            bindall <Shift-MouseWheel> {
-                set delta [expr {- (%D)}]
-                $canv xview scroll $delta units
-            }
+    } elseif {[tk windowingsystem] == "aqua"} {
+        bindall <MouseWheel> {
+            set delta [expr {- (%D)}]
+            allcanvs yview scroll $delta units
         }
+        bindall <Shift-MouseWheel> {
+            set delta [expr {- (%D)}]
+            $canv xview scroll $delta units
+        }
+    } else {
+        puts stderr [mc "Unknown windowing system, cannot bind mouse"]
     }
     bindall <$::BM> "canvscan mark %W %x %y"
     bindall <B$::BM-Motion> "canvscan dragto %W %x %y"