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