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 28, 2025, 13:30 UTC
Message-ID
<CANoM8SXnxxF6UMSfQ06ANfEv7HFCEEMCVoGgod1-DuFeHp6tXg@mail.gmail.com>
In-Reply-To
<CANoM8SW6gsfmhPYWq2_7f9DuwyQ4vVpbWkaPn4mDTg--LAZUJg@mail.gmail.com>
On Thu, Sep 25, 2025 at 8:45 AM Mike Rappazzo <rappazzo@gmail.com> wrote:
Show 30 quoted lines
>
> On Mon, Sep 22, 2025 at 2:34 AM Johannes Sixt <j6t@kdbg.org> wrote:
> > > @@ -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?
>

Digging into this a little more, I think the platform differences relate to how each window manager handles the initial window mapping and geometry setting sequence.

On MacOS, the window geometry can be set immediately during window creation without timing issues. However, on Windows and Gnome, there seems to be a race condition where setting geometry too early gets overridden by the window manager's default placement logic.

Using `after idle` ensures we set the geometry after the window manager has finished its initial setup, which is why it's needed on Windows and Gnome but not MacOS.

I will split the manage_showrefs_geometry function and send an updated patch
 _Mike
Previous: Mike Rappazzo
Message 8 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.