From: Mark Levedahl Date: Tue, 27 May 2025 03:47:39 +0000 (-0400) Subject: gitk: allow horizontal commit-graph scrolling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e4314387b0affaca5353bb3ada8e93f2722fab9;p=thirdparty%2Fgit.git gitk: allow horizontal commit-graph scrolling gitk commit 5fdcbb1390 ("gitk: Fixes for Mac OS X TkAqua", 2009-03-23), adds horizontal scrolling of the commit graph pane on aqua, but not on x11 or win32. Also, the horizontal scrolling is triggered by MouseWheel events attached to any of the three panes, not just the commit graph that is the only one that scrolls. It is unusual to scroll a widget that is not under the mouse, many would consider this a bug. No horizontal scrollbar is provided for this, so there is no real cue for the user that horizontal scrolling is available. We removed this aqua only feature by transitioning aqua to use the common MouseWheel bindings set. Let's add this as a feature on all platforms, and use the same approach for scaling scroll motion as we do elsewhere. For horizontal scrolling, honor only events received by the commit graph in conformance with normal GUI design. Vertical scrolling is unchanged, and events received by any of the 3 panes continue to scroll all 3 in unison. Per the ancient and long ignored CUA standards, we should add a horizontal scrollbar to the commit-graph, but gitk's interface is already very cluttered: adding a scrollbar to only one of these three panes is difficult while maintaining common pane vertical size, especially so considering the movable sash separating panes 1 & 2, and will consume yet more space. So, leave this as a hidden feature, now available on all platforms. Signed-off-by: Mark Levedahl --- diff --git a/gitk b/gitk index bd57a55466..ba112586be 100755 --- a/gitk +++ b/gitk @@ -2272,6 +2272,7 @@ proc bind_mousewheel {} { bind $ctext {$ctext xview scroll [scrollval %D 2] units} bind $cflist {$cflist yview scroll [scrollval %D 2] units} bind $cflist break + bind $canv {$canv xview scroll [scrollval %D] units} } proc bind_mousewheel_buttons {} { @@ -2288,6 +2289,8 @@ proc bind_mousewheel_buttons {} { bind $cflist {$cflist yview scroll [scrollval -1 2] units} bind $cflist break bind $cflist break + bind $canv {$canv xview scroll [scrollval 1] units} + bind $canv {$canv xview scroll [scrollval -1] units} } proc makewindow {} { @@ -2388,6 +2391,7 @@ proc makewindow {} { canvas $canv \ -selectbackground $selectbgcolor \ -background $bgcolor -bd 0 \ + -xscrollincr $linespc \ -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll" .tf.histframe.pwclist add $canv set canv2 .tf.histframe.pwclist.canv2