Skip to content

Commit 5518fde

Browse files
committed
gitk: commit-graph x-scrolling on all platforms
Since 5fdcbb1 ("gitk: Fixes for Mac OS X TkAqua", 2009-03-23), gitk provides horizontal scrolling of the commit graph pane on aqua, but not on x11 or win32. Also, the horizontal scrolling is triggered by mouse 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. Also, no horizontal scrollbar is provided for this, so there is no real cue for the user that horizontal scrolling is available. A prior commit removed this aqua only feature. Let's connect this as a feature on all platforms, and use the transmitted delta (%D) value and the user preference kscroll to adjust the amount scrolled for aqua and win32. x11 receives only button events, so uses $kscroll alone for the scrolling value. 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. Vertical scrolling is already scaled by the vertical font size metrics, this is a suitable value to scale the horizontal scrolling as well. 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 <[email protected]>
1 parent ae50b3c commit 5518fde

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gitk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,7 @@ proc makewindow {} {
23022302
canvas $canv \
23032303
-selectbackground $selectbgcolor \
23042304
-background $bgcolor -bd 0 \
2305+
-xscrollincr $linespc \
23052306
-yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
23062307
.tf.histframe.pwclist add $canv
23072308
set canv2 .tf.histframe.pwclist.canv2
@@ -2687,6 +2688,7 @@ proc makewindow {} {
26872688
bind $ctext <Shift-MouseWheel> {$ctext xview scroll [expr -%D*$kscroll/120] units}
26882689
bind $cflist <MouseWheel> {$cflist yview scroll [expr -%D*$kscroll/120] units}
26892690
bind $cflist <Shift-MouseWheel> {$cflist xview scroll [expr -%D*$kscroll/120] units}
2691+
bind $canv <Shift-MouseWheel> {$canv xview scroll [expr -%D*$kscroll/120] units}
26902692
} elseif {[tk windowingsystem] == "x11"} {
26912693
bindall <ButtonRelease-4> {allcanvs yview scroll -$kscroll units}
26922694
bindall <ButtonRelease-5> {allcanvs yview scroll $kscroll units}
@@ -2700,13 +2702,16 @@ proc makewindow {} {
27002702
bind $cflist <ButtonRelease-5> {$cflist yview scroll $kscroll units}
27012703
bind $cflist <Shift-ButtonRelease-4> {$cflist xview scroll -$kscroll units}
27022704
bind $cflist <Shift-ButtonRelease-5> {$cflist xview scroll $kscroll units}
2705+
bind $canv <Shift-ButtonRelease-4> {$canv xview scroll -$kscroll units}
2706+
bind $canv <Shift-ButtonRelease-5> {$canv xview scroll $kscroll units}
27032707
} elseif {[tk windowingsystem] == "aqua"} {
27042708
bindall <MouseWheel> {allcanvs yview scroll [expr -%D*$kscroll] units}
27052709
bindall <Shift-MouseWheel> break
27062710
bind $ctext <MouseWheel> {$ctext yview scroll [expr -%D*$kscroll] units}
27072711
bind $ctext <Shift-MouseWheel> {$ctext xview scroll [expr -%D*$kscroll] units}
27082712
bind $cflist <MouseWheel> {$cflist yview scroll [expr -%D*$kscroll] units}
27092713
bind $cflist <Shift-MouseWheel> {$cflist xview scroll [expr -%D*$kscroll] units}
2714+
bind $canv <Shift-MouseWheel> {$canv xview scroll [expr -%D*$kscroll] units}
27102715
} else {
27112716
puts stderr "Unknown windowing system, cannot bind mouse"
27122717
}

0 commit comments

Comments
 (0)