From 82f0b92683a5219587b86d8625110746d2e767b4 Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Fri, 6 Jun 2025 00:03:33 -0400 Subject: [PATCH] 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 --- gitk | 27 ++++++++++++++++++--------- 1 file 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 break } +proc bind_mousewheel_buttons {} { + global canv cflist ctext + bindall {allcanvs yview scroll [scrollval 1] units} + bindall {allcanvs yview scroll [scrollval -1] units} + bindall break + bindall break + bind $ctext {$ctext yview scroll [scrollval 1 2] units} + bind $ctext {$ctext yview scroll [scrollval -1 2] units} + bind $ctext {$ctext xview scroll [scrollval 1 2] units} + bind $ctext {$ctext xview scroll [scrollval -1 2] units} + bind $cflist {$cflist yview scroll [scrollval 1 2] units} + bind $cflist {$cflist yview scroll [scrollval -1 2] units} + bind $cflist break + bind $cflist 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 "allcanvs yview scroll -5 units" - bindall "allcanvs yview scroll 5 units" - bind $ctext