git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] gitk: make Tags and Heads window geometry sticky

From
Mike Rappazzo <rappazzo@gmail.com>
Date
Sep 25, 2025, 12:45 UTC
Message-ID
<CANoM8SW6gsfmhPYWq2_7f9DuwyQ4vVpbWkaPn4mDTg--LAZUJg@mail.gmail.com>
In-Reply-To
<c6a33014-5d87-4750-b6ce-234e944131b4@kdbg.org>
On Mon, Sep 22, 2025 at 2:34 AM Johannes Sixt <j6t@kdbg.org> wrote:
Show 19 quoted lines
> > @@ -10249,6 +10256,8 @@ proc showrefs {} {
> >      bind $top.list <ButtonRelease-1> {sel_reflist %W %x %y; break}
> >      set reflist {}
> >      refill_reflist
> > +    after idle [list manage_showrefs_geometry $top restore]
>
> My thinking without having debugged it is:
>
>  1. A Configure event happens with the default geometry when the window
> becomes visible. This records the default geometry in geometry(showrefs)
> by the handler that is bound in the next line below.
>
>  2. "After idle" the geometry is set to the then-current value of
> geometry(showrefs), which would then be the default geometry and not the
> one restored from the settings.
>
> Why is it not necessary to encode the now-current value of
> geometry(showrefs) (the restored value) in this after-idle handler? IOW,
> why does this work?

When I was testing this, I used MacOS, Windows 11, and Gnome (Ubuntu). On Mac the call worked without the `after idle`. On both Windows and Gnome, it needed the `after idle` for it to work as I expected. I'm not sure exactly why. Do you want me to try to adjust this? Do you have a suggestion for it?

Show 18 quoted lines
> > +proc manage_showrefs_geometry {top action} {
> > +    global geometry
> > +    switch $action {
> > +        save {
> > +            if {[winfo exists $top]} {
> > +                set geometry(showrefs) [wm geometry $top]
> > +            }
> > +        }
> > +        restore {
> > +            if {[info exists geometry(showrefs)] && [winfo exists $top]} {
> > +                after 1 [list wm geometry $top $geometry(showrefs)]
> > +            }
> > +        }
> > +    }
> > +}
>
> The two branches have no common code path. What is the rationale to have
> a single function with sub-commands instead of two distinct functions?

Yeah, that's my bad. I started with something different, and whittled it down to this. I'll adjust in the next iteration.

_Mike
Previous: Johannes SixtNext: Mike Rappazzo
Message 7 of 8 in “gitk: make the 'Tags and Heads' window geometry sticky”
  1. 0/2 gitk: make the 'Tags and Heads' window geometry stickyMichael Rappazzo, Sep 20, 2025
  2. 1/2 gitk: fix the position of the main main window on initializeMichael Rappazzo, Sep 20, 2025
  3. Johannes SixtSep 22, 2025
  4. Mark LevedahlSep 22, 2025
  5. 2/2 gitk: make Tags and Heads window geometry stickyMichael Rappazzo, Sep 20, 2025
  6. Johannes SixtSep 22, 2025
  7. Mike RappazzoSep 25, 2025
  8. Mike RappazzoSep 28, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.