From 7c06c19e66e7654031eb50b72fd79c380fa54158 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Sun, 24 Aug 2025 18:07:58 +0800 Subject: [PATCH 1/3] gitk: use for ctx menus on macOS with Tcl 8.7+ Commit d277e89f87fda01daa1e1a35fc1f7118678faa1f added special handling on macOS (OS X) that makes button 2 the right mouse button. As per TIP 474 [1], Tcl 8.7 has swapped buttons 2 and 3 such that button 3 is made the right mouse button as in other platforms. Therefore, the logic should be updated to use button 3 on macOS with Tcl 8.7+. [1]: https://core.tcl-lang.org/tips/doc/main/tip/474.md Signed-off-by: Ruoyu Zhong --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index 3b6acfc592..2e1b629d7d 100755 --- a/gitk +++ b/gitk @@ -12596,7 +12596,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 } else { set ctxbut From 432669914b2fb812bc62e3b52176a8bfc8e4d667 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Wed, 27 Aug 2025 10:12:19 +0800 Subject: [PATCH 2/3] gitk: fix trackpad scrolling for Tcl/Tk 8.7+ TIP 684 [1] introduced TouchpadScroll events in Tcl/Tk 8.7, separating trackpad gestures from traditional MouseWheel events. This broke trackpad scrolling in gitk where trackpads generate TouchpadScroll events instead of MouseWheel events. Fix that by adding TouchpadScroll event bindings for all scrollable widgets following the TIP 684 specification. Implement a new precisescrollval proc to handle the smaller delta values from TouchpadScroll events, using appropriate scaling factors that seem sensible on my MacBook. Fixes https://github.com/j6t/gitk/issues/31. [1]: https://core.tcl-lang.org/tips/doc/main/tip/684.md Signed-off-by: Ruoyu Zhong --- gitk | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gitk b/gitk index 2e1b629d7d..6e4d71d585 100755 --- a/gitk +++ b/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 {allcanvs yview scroll [scrollval %D] units} @@ -2319,6 +2324,25 @@ proc bind_mousewheel {} { bind $cflist {$cflist yview scroll [scrollval 5*%D 2] units} bind $cflist break bind $canv {$canv xview scroll [scrollval 5*%D] units} + + bindall { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + allcanvs yview scroll [precisescrollval $deltaY] units + } + bind $ctext { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $ctext yview scroll [precisescrollval $deltaY 2] units + $ctext xview scroll [precisescrollval $deltaX 2] units + } + bind $cflist { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $cflist yview scroll [precisescrollval $deltaY 2] units + } + bind $canv { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + $canv xview scroll [precisescrollval $deltaX] units + allcanvs yview scroll [precisescrollval $deltaY] units + } } } From ac8fec7d8de265e56441713faaf4e08f11c31469 Mon Sep 17 00:00:00 2001 From: Michael Rappazzo Date: Wed, 27 Aug 2025 18:59:56 -0400 Subject: [PATCH 3/3] gitk: add README with usage, build, and contribution details Signed-off-by: Michael Rappazzo Signed-off-by: Johannes Sixt --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..2e307463c6 --- /dev/null +++ b/README.md @@ -0,0 +1,93 @@ +Gitk - The Git Repository Browser +================================= + +Gitk is a graphical Git repository browser. It displays the commit +history of a Git repository as a graph, showing the relationships +between commits, branches, and tags. + +Usage +===== + +To view the history of the current repository: +```bash +gitk +``` + +To view the history of specific files or directories: +```bash +gitk path/to/file +gitk path/to/directory +``` + +To view a specific branch or range of commits: +```bash +gitk branch-name +gitk v1.0..v2.0 +``` + +For more usage examples and options, see the [gitk manual](https://git-scm.com/docs/gitk). + +Building +======== + +Gitk is a Tcl/Tk application. It requires Tcl/Tk to be installed on +your system. + +Running directly +---------------- + +Gitk can be run from the source directory without installation: + +```bash +./gitk +``` + +This allows for quick testing of changes. + +Installation +------------ + +To install system-wide, you can use either `make` or `meson`: + +```bash +# Install to default location ($HOME/bin) +make install + +# Install to system-wide location +sudo make install prefix=/usr/local + +# Install to custom location +make install prefix=/opt/gitk + +# Using Meson +meson setup builddir +meson compile -C builddir +meson install -C builddir +``` + +Both build systems will handle setting the correct Tcl/Tk interpreter +path and installing translation files. + +Contributing +============ + +Contributions are welcome! The preferred method for submitting patches +is via email to the Git mailing list, as this allows for more thorough +review and broader community feedback. However, GitHub pull requests +are also accepted. + +All commits must be signed off (use `git commit --signoff`) and should +have commit messages prefixed with `gitk:`. + +Email Patches +------------- + +Send patches to git@vger.kernel.org and CC j6t@kdbg.org. See the Git +project's [patch submission guidelines](https://git-scm.com/docs/SubmittingPatches) +for detailed instructions on creating and sending patches. + +License +======= + +Gitk is distributed under the GNU General Public License, either +version 2, or (at your option) any later version.