aboutsummaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2025-06-06 00:03:33 -0400
committerMark Levedahl <mlevedahl@gmail.com>2025-07-16 23:01:51 -0400
commit82f0b92683a5219587b86d8625110746d2e767b4 (patch)
treed6548cfc159948e983521edce33583d54ed5b4bc /gitk
parent61c74d062bd9fd35c6f9a17b488abce88d560566 (diff)
downloadgit-82f0b92683a5219587b86d8625110746d2e767b4.tar.xz
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 <mlevedahl@gmail.com>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk27
1 files changed, 18 insertions, 9 deletions
diff --git a/gitk b/gitk
index 124e39c519..dd36e4c1b9 100755
--- a/gitk
+++ b/gitk
@@ -2274,6 +2274,22 @@ proc bind_mousewheel {} {
bind $cflist <Shift-MouseWheel> break
}
+proc bind_mousewheel_buttons {} {
+ global canv cflist ctext
+ bindall <ButtonRelease-4> {allcanvs yview scroll [scrollval 1] units}
+ bindall <ButtonRelease-5> {allcanvs yview scroll [scrollval -1] units}
+ bindall <Shift-ButtonRelease-4> break
+ bindall <Shift-ButtonRelease-5> break
+ bind $ctext <ButtonRelease-4> {$ctext yview scroll [scrollval 1 2] units}
+ bind $ctext <ButtonRelease-5> {$ctext yview scroll [scrollval -1 2] units}
+ bind $ctext <Shift-ButtonRelease-4> {$ctext xview scroll [scrollval 1 2] units}
+ bind $ctext <Shift-ButtonRelease-5> {$ctext xview scroll [scrollval -1 2] units}
+ bind $cflist <ButtonRelease-4> {$cflist yview scroll [scrollval 1 2] units}
+ bind $cflist <ButtonRelease-5> {$cflist yview scroll [scrollval -1 2] units}
+ bind $cflist <Shift-ButtonRelease-4> break
+ bind $cflist <Shift-ButtonRelease-5> break
+}
+
proc makewindow {} {
global canv canv2 canv3 linespc charspc ctext cflist cscroll
global tabstop
@@ -2716,15 +2732,8 @@ proc makewindow {} {
set scroll_D0 120
bind_mousewheel
} elseif {[tk windowingsystem] == "x11"} {
- 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
- }
- }
+ set scroll_D0 1
+ bind_mousewheel_buttons
} elseif {[tk windowingsystem] == "aqua"} {
bindall <MouseWheel> {
set delta [expr {- (%D)}]