# [PATCH] gitk: Enable mouse horizontal scrolling in diff pane

3 messages from 2014-11-15 to 2015-03-22. Participants: Gabriele Mazzotta, Stefan Haller, Paul Mackerras.
Thread: https://gitlist.dev/t/37977

## Gabriele Mazzotta, 2014-11-15 14:05

Subject: [PATCH] gitk: Enable mouse horizontal scrolling in diff pane
Message-ID: <1416060306-4048-1-git-send-email-gabriele.mzt@gmail.com>
URL: https://gitlist.dev/e/1416060306-4048-1-git-send-email-gabriele.mzt%40gmail.com

```
Currently it's required to hold Shift and scroll up and down to move
horizontally. Listen to Button-6 and Button-7 events too to make
horizontal scrolling handier with touchpads and some mice.

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
---
 gitk-git/gitk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 78358a7..95a98e3 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2516,6 +2516,13 @@ proc makewindow {} {
     } else {
 	bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
 	bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
+        bind $ctext <Button> {
+            if {"%b" eq 6} {
+                $ctext xview scroll -5 units
+            } elseif {"%b" eq 7} {
+                $ctext xview scroll 5 units
+            }
+        }
         if {[tk windowingsystem] eq "aqua"} {
             bindall <MouseWheel> {
                 set delta [expr {- (%D)}]
-- 
2.1.3

```

## Stefan Haller, 2014-11-16 08:00

Subject: Re: [PATCH] gitk: Enable mouse horizontal scrolling in diff pane
Message-ID: <1lv745j.1ypmc8r5ybicrM%lists@haller-berlin.de>
URL: https://gitlist.dev/e/1lv745j.1ypmc8r5ybicrM%25lists%40haller-berlin.de
In-Reply-To: <1416060306-4048-1-git-send-email-gabriele.mzt@gmail.com>

```
Gabriele Mazzotta <gabriele.mzt@gmail.com> wrote:

> Currently it's required to hold Shift and scroll up and down to move
> horizontally. Listen to Button-6 and Button-7 events too to make
> horizontal scrolling handier with touchpads and some mice.

Hm, on my Macbook the diff pane already scrolls in all four directions
with two-finger scrolling on the trackpad. (Without your patch, I mean.)

In my copy of gitk I did the opposite for the commit list though; I
can't stand it that I accidentally scroll left or right with the
trackpad, so I commented out some code to restrict it to only vertical
scrolling. I never posted this patch because I bet many people like the
current behaviour. Just so you know that such a change might be
controversial.


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/

```

## Paul Mackerras, 2015-03-22 03:37

Subject: Re: [PATCH] gitk: Enable mouse horizontal scrolling in diff pane
Message-ID: <20150322033717.GA14271@iris.ozlabs.ibm.com>
URL: https://gitlist.dev/e/20150322033717.GA14271%40iris.ozlabs.ibm.com
In-Reply-To: <1416060306-4048-1-git-send-email-gabriele.mzt@gmail.com>

```
On Sat, Nov 15, 2014 at 03:05:06PM +0100, Gabriele Mazzotta wrote:
> Currently it's required to hold Shift and scroll up and down to move
> horizontally. Listen to Button-6 and Button-7 events too to make
> horizontal scrolling handier with touchpads and some mice.
> 
> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>

Thanks, applied.

Paul.

```
