aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2025-05-26 23:47:39 -0400
committerMark Levedahl <mlevedahl@gmail.com>2025-07-16 23:01:51 -0400
commit3e4314387b0affaca5353bb3ada8e93f2722fab9 (patch)
treea131c9db6a28509a5627c0e7066bbc125c8b1e7f
parent24fb77a2a8218017ca38e28165eec4f9b7be141d (diff)
downloadgit-3e4314387b0affaca5353bb3ada8e93f2722fab9.tar.gz
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 <mlevedahl@gmail.com>
-rwxr-xr-xgitk4
1 files changed, 4 insertions, 0 deletions
diff --git a/gitk b/gitk
index bd57a55466..ba112586be 100755
--- a/gitk
+++ b/gitk
@@ -2272,6 +2272,7 @@ proc bind_mousewheel {} {
bind $ctext <Shift-MouseWheel> {$ctext xview scroll [scrollval %D 2] units}
bind $cflist <MouseWheel> {$cflist yview scroll [scrollval %D 2] units}
bind $cflist <Shift-MouseWheel> break
+ bind $canv <Shift-MouseWheel> {$canv xview scroll [scrollval %D] units}
}
proc bind_mousewheel_buttons {} {
@@ -2288,6 +2289,8 @@ proc bind_mousewheel_buttons {} {
bind $cflist <ButtonRelease-5> {$cflist yview scroll [scrollval -1 2] units}
bind $cflist <Shift-ButtonRelease-4> break
bind $cflist <Shift-ButtonRelease-5> break
+ bind $canv <Shift-ButtonRelease-4> {$canv xview scroll [scrollval 1] units}
+ bind $canv <Shift-ButtonRelease-5> {$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