Skip to content

Commit 82f0b92

Browse files
committed
gitk: update x11 scrolling for TclTk 8.6 / TIP 171
gitk has x11 mouse bindings that receive button presses, not MouseWheel events, as this is the Tk implementation through Tk 8.6. On x11, gitk translates each button event to a scrolling value of +/- 5 for the upper three panes that scroll vertically as one unit. gitk applies similar scaling for horizontal scaling of the lower-left commit details pane (ctext), but not for vertical scrolling of either of the bottom panes. Rather, the Tk default scrolling actions are used for vertical scrolling. Let's make X11 behave similarly to the just modified win32 platform. Do so by connecting vertical and horizontal scrolling events for the same items bound in 'proc bind_mousewheel' and using the same user preference values. Signed-off-by: Mark Levedahl <[email protected]>
1 parent 61c74d0 commit 82f0b92

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

gitk

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,6 +2274,22 @@ proc bind_mousewheel {} {
22742274
bind $cflist <Shift-MouseWheel> break
22752275
}
22762276
2277+
proc bind_mousewheel_buttons {} {
2278+
global canv cflist ctext
2279+
bindall <ButtonRelease-4> {allcanvs yview scroll [scrollval 1] units}
2280+
bindall <ButtonRelease-5> {allcanvs yview scroll [scrollval -1] units}
2281+
bindall <Shift-ButtonRelease-4> break
2282+
bindall <Shift-ButtonRelease-5> break
2283+
bind $ctext <ButtonRelease-4> {$ctext yview scroll [scrollval 1 2] units}
2284+
bind $ctext <ButtonRelease-5> {$ctext yview scroll [scrollval -1 2] units}
2285+
bind $ctext <Shift-ButtonRelease-4> {$ctext xview scroll [scrollval 1 2] units}
2286+
bind $ctext <Shift-ButtonRelease-5> {$ctext xview scroll [scrollval -1 2] units}
2287+
bind $cflist <ButtonRelease-4> {$cflist yview scroll [scrollval 1 2] units}
2288+
bind $cflist <ButtonRelease-5> {$cflist yview scroll [scrollval -1 2] units}
2289+
bind $cflist <Shift-ButtonRelease-4> break
2290+
bind $cflist <Shift-ButtonRelease-5> break
2291+
}
2292+
22772293
proc makewindow {} {
22782294
global canv canv2 canv3 linespc charspc ctext cflist cscroll
22792295
global tabstop
@@ -2716,15 +2732,8 @@ proc makewindow {} {
27162732
set scroll_D0 120
27172733
bind_mousewheel
27182734
} elseif {[tk windowingsystem] == "x11"} {
2719-
bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
2720-
bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
2721-
bind $ctext <Button> {
2722-
if {"%b" eq 6} {
2723-
$ctext xview scroll -5 units
2724-
} elseif {"%b" eq 7} {
2725-
$ctext xview scroll 5 units
2726-
}
2727-
}
2735+
set scroll_D0 1
2736+
bind_mousewheel_buttons
27282737
} elseif {[tk windowingsystem] == "aqua"} {
27292738
bindall <MouseWheel> {
27302739
set delta [expr {- (%D)}]

0 commit comments

Comments
 (0)