summaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2025-06-05 21:45:22 -0400
committerMark Levedahl <mlevedahl@gmail.com>2025-07-16 23:01:51 -0400
commit429bbf449c4ce43330e16422070080c314f8b8c4 (patch)
treea2aad2fecb858e7d2383445b1819b8c24c8c481c /commit-graph.c
parentec02983e8da3ec625092792651e64aef45b778e1 (diff)
gitk: mousewheel scrolling functions for Tk 8.6
gitk supports scrolling of 5 windows, but does this differently on the aqua, x11, and win32 platforms as Tk provides different events on each. TIP 171 removes some differences on win32 while altering the required bindings on x11. TIP 474, which is in Tk 8.7 and later, finally unifies all platforms on using common MouseWheel bindings. Importantly for now, TIP 171 causes delivery of MouseWheel events to the widget under the mouse cursor on win32, eliminating the need for completely different bindings on win32. Let's make some common functions to unify as much as we can in Tk 8.6. Examining the platforms shows that the default platform scrolling is overridden differently on the 3 platforms, and the nominal amount of motion achieved per mouse wheel "click" is different. win32 nominally makes everything move 5 lines per click, aqua 1 line per click, and x11 is a mixture. Part of this is due to win32 overriding all scroll events, while x11 and aqua override smaller sets. Also, note that the text widgets (the lower two panes) always scroll by 2-3 lines when given a smaller scroll amount, while the upper three canvas objects follow the requested scrolling value more accurately. First, let's have a common routine to calculate the scroll value to give to a widget in an event. This accounts for the user preference, the scale of the %D (delta) value given by the event (120 on win32, 1 on aqua, assumed 1 on x11), and must always be integer. Include negation as by convention the screen moves opposite to the MouseWheel delta. Allow setting an offset value to account for the larger minimum scrolling of text widgets. Second, let's have a common declaration of MouseWheel event bindings, as those are shared by all in Tcl9, and by aqua/win32 earlier. Bind all five display windows here. Note that the Patch/Tree widget (cflist) cannot scroll horizontally. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions