diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-09-10 14:27:52 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-09-10 14:27:52 -0700 |
| commit | f2457a6f4ba4ae8078fa7559f6292786a287f696 (patch) | |
| tree | 94de60aeb9b3116279a0e0456be461988b60517c /gitk-git/gitk | |
| parent | 4975ec3473b4bc61bc8a3df1ef29d0b7e7959e87 (diff) | |
| parent | ac8fec7d8de265e56441713faaf4e08f11c31469 (diff) | |
| download | git-f2457a6f4ba4ae8078fa7559f6292786a287f696.tar.gz | |
Merge branch 'master' of https://github.com/j6t/gitk
* 'master' of https://github.com/j6t/gitk:
gitk: add README with usage, build, and contribution details
gitk: fix trackpad scrolling for Tcl/Tk 8.7+
gitk: use <Button-3> for ctx menus on macOS with Tcl 8.7+
Diffstat (limited to 'gitk-git/gitk')
| -rwxr-xr-x | gitk-git/gitk | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gitk-git/gitk b/gitk-git/gitk index 3b6acfc592..6e4d71d585 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2301,6 +2301,11 @@ proc scrollval {D {koff 0}} { return [expr int(-($D / $scroll_D0) * max(1, $kscroll-$koff))] } +proc precisescrollval {D {koff 0}} { + global kscroll + return [expr (-($D / 10.0) * max(1, $kscroll-$koff))] +} + proc bind_mousewheel {} { global canv cflist ctext bindall <MouseWheel> {allcanvs yview scroll [scrollval %D] units} @@ -2319,6 +2324,25 @@ proc bind_mousewheel {} { bind $cflist <Alt-MouseWheel> {$cflist yview scroll [scrollval 5*%D 2] units} bind $cflist <Alt-Shift-MouseWheel> break bind $canv <Alt-Shift-MouseWheel> {$canv xview scroll [scrollval 5*%D] units} + + bindall <TouchpadScroll> { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + allcanvs yview scroll [precisescrollval $deltaY] units + } + bind $ctext <TouchpadScroll> { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $ctext yview scroll [precisescrollval $deltaY 2] units + $ctext xview scroll [precisescrollval $deltaX 2] units + } + bind $cflist <TouchpadScroll> { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $cflist yview scroll [precisescrollval $deltaY 2] units + } + bind $canv <TouchpadScroll> { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $canv xview scroll [precisescrollval $deltaX] units + allcanvs yview scroll [precisescrollval $deltaY] units + } } } @@ -12596,7 +12620,7 @@ set foundbgcolor yellow set currentsearchhitbgcolor orange # button for popping up context menus -if {[tk windowingsystem] eq "aqua"} { +if {[tk windowingsystem] eq "aqua" && [package vcompare $::tcl_version 8.7] < 0} { set ctxbut <Button-2> } else { set ctxbut <Button-3> |
