Application window geometry specifier

Chris Angelico rosuav at gmail.com
Tue Jan 12 17:02:18 EST 2021


On Wed, Jan 13, 2021 at 7:00 AM Igor Korot <ikorot01 at gmail.com> wrote:
>
> Hi, Chris,
>
> On Tue, Jan 12, 2021 at 1:33 PM Chris Angelico <rosuav at gmail.com> wrote:
> >
> > On Wed, Jan 13, 2021 at 6:18 AM Igor Korot <ikorot01 at gmail.com> wrote:
> > >
> > > Hi, Grant,
> > >
> > > On Tue, Jan 12, 2021 at 12:47 PM Grant Edwards
> > > <grant.b.edwards at gmail.com> wrote:
> > > >
> > > > On 2021-01-12, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> > > > > On Tue, 12 Jan 2021, Igor Korot wrote:
> > > > >
> > > > >> Keep in mind that if you target Linux, the "modern" window server
> > > > >> (Wayland) will not allow user code to decide the positioning and size of
> > > > >> the TLW.
> > > > >
> > > > > Igor,
> > > > >
> > > > > I suspect that Slackware will continue with X11.
> > > >
> > > > And those X11 users will swear at you if you override their window
> > > > managers configured window placement. Application code should not care
> > > > about or try to control window geometry. Period.
> > >
> > > I have a very strong argument against it!!
> > >
> > > Imagine you are developing an application that need to communicate
> > > with the database.
> > > Also imagine this application will be used by millions of users inside
> > > different companies.
> > >
> > > SInce the application will require DB access you will need a dialog to
> > > ask for credentials.
> > >
> > > I, personally, would be very surprised if such dialog would appear
> > > somewhere at the bottom of the screen,
> > > as dialogs ARE TLWs (top level windows).
> > >
> > > Wouldn't you?
> >
> > Yes, I would too - because I have my window manager configured to
> > place that dialog where *I* want it, not where the application
> > developer chose to put it.
>
> So, how do *you* distinguish between such dialog and all other dialogs
> an application might raise (open/save dialogs. font selection dialog, user
> warning thing).
>
> Because with my scenario there are 2 TLWs in the picture - main frame and
> dialog for credentials.
>
> Besides it looks like you are setting this dialog to appear at constant position
> anyway. Or am I missing smth?

Hmm, maybe I'm missing something. The initial window isn't a "dialog",
it's an application window. They follow slightly different rules
(mainly, they don't have a parent window), but they still follow
*rules*.

> > > So why I somewhat agree with such a notion - it is not always a useful feature.
> > > Also, such an algorithm better allow me to save and restore the
> > > geometry of the TLW.
> >
> > Why save and restore the geometry when the window manager can do a
> > better job of positioning it? Give the WM the hints it needs, then let
> > it figure out the placement.
>
> Because I want this application to appear at the same place every time?
> The first time it shows I may just drag it away or minimize it at some point or
> make it very small to clear the space.
>
> And the next time I want it to start at the same position.

And I find that most apps that behave this way end up being more
annoying than not.

> > Consider that the last time your window was opened, I might have had
> > one 1366x768 monitor, but now I have four - 1920x1080, 1920x1080,
> > 1280x1024, and 1600x900. Where should your dialog go? Not your
> > problem, because my WM knows and understands.
>
> There is a notion of the "primary display" which is here for a reason. ;-)
> So you can attach/detach as many monitors as you want - in the end if
> the monitor is not available and that window will appear on the primary monitor.

In the second scenario, the primary monitor is at position (1920, 0).
So you've just described exactly what a window manager does - follow
rules to decide where the window appears - and NOT what happens if you
remember geometry, which would be to put the window somewhere in the
top left. You see the problem with remembering geometry?

> > (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.

ChrisA


More information about the Python-list mailing list