# [PATCH] gitk: Added support for OS X mouse wheel

1 messages from 2007-10-13 to 2007-10-13. Participants: Jonathan del Strother.
Thread: https://gitlist.dev/t/10266

## Jonathan del Strother, 2007-10-13 17:33

Subject: [PATCH] gitk: Added support for OS X mouse wheel
Message-ID: <193EA1A3-1BE3-42E4-8A47-0F025E0D3645@steelskies.com>
URL: https://gitlist.dev/e/193EA1A3-1BE3-42E4-8A47-0F025E0D3645%40steelskies.com

```
(Väinö Järvelä supplied this patch a while ago for 1.5.2.  It no longer
applied cleanly, so I'm reposting it.)

MacBook doesn't seem to recognize MouseRelease-4 and -5 events, at all.
So i added a support for the MouseWheel event, which i limited to Tcl/tk
aqua, as i couldn't test it neither on Linux or Windows. Tcl/tk needs to
be updated from the version that is shipped with OS X 10.4 Tiger, for
this patch to work.

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---
  gitk |   14 ++++++++++----
  1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gitk b/gitk
index 300fdce..9b3e627 100755
--- a/gitk
+++ b/gitk
@@ -838,11 +838,17 @@ proc makewindow {} {
      bindall <1> {selcanvline %W %x %y}
      #bindall <B1-Motion> {selcanvline %W %x %y}
      if {[tk windowingsystem] == "win32"} {
-	bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
-	bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y % 
D ; break }
+        bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y  
%D }
+        bind $ctext <MouseWheel> { windows_mousewheel_redirector %W % 
X %Y %D ; break }
      } else {
-	bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
-	bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
+        bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
+        bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
+        if {[tk windowingsystem] eq "aqua"} {
+            bindall <MouseWheel> {
+                set delta [expr {- (%D)}]
+                allcanvs yview scroll $delta units
+            }
+        }
      }
      bindall <2> "canvscan mark %W %x %y"
      bindall <B2-Motion> "canvscan dragto %W %x %y"
-- 
1.5.3.1

```
