Wayland and window position/size

Carsten Haitzler raster at rasterman.com
Wed May 26 01:51:05 UTC 2021


On Tue, 25 May 2021 16:24:30 -0500 Igor Korot <ikorot01 at gmail.com> said:

> Hi, list,
> Couple of questions about Wayland, since more and more distros switching ;-)
> 
> If I understand correctly window positioning/sizing is based on the
> compositor/window content.
> 
> 1. Is there a way to select where each individual program will start?

The compositor decides this. It may place it randomly, somewhere intelligently
with minimum overlap, relative to some parent surface/window or perhaps it
might store the position it saw that named window at last and restore it to
that position. The compositor may expose such settings to the user, or maybe
not. It's between the compositor and the user and the idea is that it will be
consistent with all windows.

> 1a. If not - will there be one?
> 2. I am working on the program that should start up with the empty
> window - only the toolbar
> and the very basic menu.
> Then when the user chooses some action from the toolbar some child
> windows appear.
> I think such program will always start up with very minimal size,
> basically the size of the toolbar
> under Wayland. Am I wrong?

That is up to your program. It could create a very wide and narrow window with
just menu bar and toolbar. That's perfectly possible - the buffer you provide
will determine this. Generally for most applications the toolkit you use will
handle all of this for you, unless you are making your own toolkit or you are
nutty enough to avoid a toolkit entirely and try and write everything "bare
metal" in which case essentially your app includes a toolkit and thus the work
that toolkits normally do becomes your work.

> 3. How can one write a cross-platform application that should behave
> the same on the different
> platforms when the developer doesn't have control over window position/size.

Don't try and position a window. I write applications and I simply don't go
positioning the window in my own code. I leave it to the system to decide. It
just so happens my apps work on multiple platforms too because the toolkit
handles that. I expect the system to provide some sensible window positioning
of its own. I know full well that this falls apart quickly unless you spend a
lot of effort doing things like adapting the position you want to the current
resolution, and avoiding putting your window under other obstacles like
panels/taskbars and other elements. I just let the WM/compositor handle that.
If a user has a tiling WM/compositor or a WM capable of tiling modes then
trying to position your window instantly falls apart and assuming/expecting
this works is a recipe for pain.

> 4. How can a developer write a program that should connect to the database?

That has nothing to do with Wayland or display systems in general - that's your
job. What kind of database, where it is, how it's dealt with is up to you. A
separate problem entirely.

> 5. I know there was a plan to respect a save/restore window
> positioning/size. Is it implemented?

This is up to compositors to do. Your job is to provide a name for your
window(s) in Wayland so a compositor can implement this sanely.

> 6. How complete is Wayland API currently in terms of window
> positioning/sizing?

Positioning - Don't position and Wayland discourages it by not having such an
API. Sizing - do whatever you like.

> Thank you.
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com



More information about the wayland-devel mailing list