Application window geometry specifier

Chris Angelico rosuav at gmail.com
Tue Jan 12 17:35:32 EST 2021


On Wed, Jan 13, 2021 at 9:30 AM Igor Korot <ikorot01 at gmail.com> wrote:
>
> Not sure I follow - frame is a TLW. Dialog is a TLW.
> Program flow is as follows:
>
> 1. Program starts with a frame
> 2. At some point the user asks to connect to the database.
> 3. Credentials dialog is shown.
>
> Now, while frame is TLW and may follow the renderer rules, the dialog
> that vask the user for credentials should not.
>
> Now, system dialog should probably follow the rules of the WM, but if I want my
> dialog to appear centered on the parent (not on the screen) - what
> right the WM have
> to override it?
>
> I also think that ALL dialogs are TLWs independently of whether they
> are created with
> the actual parent (frame) or a null-parent (desktop).
> In regards that they are not buttons/list controls/toolbars/etc.

In one sense you're right, but in another, the creation of a window
with a parent is very different from the creation of a window without
a parent. The WM will handle them differently because the user will
expect them to behave differently. In fact, centering on the parent is
a very likely position, so don't worry about it - just declare your
parent correctly.

> Are you talking about geometry or a position?
> For me geometry is a complex thing - position, size of the window and
> the client size
> of the window (which is important especially in *nix).

The size of the window is generally governed by its contents, so
that's under the application's control (within limits set by the WM).
The position, though, is up to the WM.

> > > > (That's actually a 100% realistic scenario, given that I'm usually on
> > > > my desktop system, but occasionally I'll be on my laptop, SSH'd in
> > > > with X11 forwarding.)
> > >
> > > Absolutely.
> > > I found myself in this situation recently - when I'm in the office I
> > > have 2 external
> > > monitors, and when I am at home - I only have a laptop.
> > > And windows are showing on the primary all the time.
> > >
> >
> > Right! That's the WM's job. Let it do its job, and everyone's lives
> > will be easier.
>
> Well, please re-read my initial statement.
> You can't decide where to put that credential dialog. It has to appear
> in the middle
> of the screen (if there is 1 - on it, if multiple - on the screen
> where the main frame is).
>
> DO you see the problem with that?

Yes, I see a problem with the application trying to remember where the
dialog was last time. A MAJOR problem. Restoring the dialog's geometry
might have it completely off screen, or at best, in a position that is
decidedly unideal. But if you let the WM decide where the dialog
should be placed, it's guaranteed to be where the user expects it (or
more precisely, it's guaranteed to be consistent with every *other*
application that also behaves like this, and the user has the power to
configure this).

ChrisA


More information about the Python-list mailing list