Wayland design principles (Re: wayland and gambas)

Carsten Haitzler raster at rasterman.com
Tue Apr 30 05:23:44 UTC 2024


On Mon, 29 Apr 2024 22:38:10 +0100 Bruce Steers <bsteers4 at gmail.com> said:

> On Mon, 29 Apr 2024, 20:53 Thiago Macieira, <thiago at kde.org> wrote:
> 
> > On Monday 29 April 2024 10:05:32 GMT-7 Bruce Steers wrote:
> > > I guess/hope a similar thing will happen to x11 or Wayland will accept
> > this
> > > particular issue needs addressing and provide a workaround.
> > >
> > > As fundamentally Wayland principles are to us, restrictive in a way that
> > I
> > > think many will simply not tolerate.
> >
> > Please describe the need you have, not the means by which you think you
> > can
> > solve the need. For example, why do you think you need to specify absolute
> > positioning for certain windows?
> >
> 
> I personally have written many applications with gambas.
> 
> Some have no issue like my text editor for example, a standard looking
> editor with window and title bar.
> 
> Although gambas provides a Settings.Write(window_name) /
> Settings.Read(window_name) that saves/restores the window placement and
> size. It's bearable Wayland does not handle this.

YOU should never be handling this. It's like saying "I'm used to having to
hand-crank my car's motor for it to start... why can't I keep doing that?".

You should provide some unique naming for your windows. So they can't be
confused with other windows of yours or of other apps. Use the ame name each
time for that window. The rest is the compositor's job. It is in charge of
deciding to rememebr position, size, stacking, etc. etc. - and it likely will
do a drastically better job that 99% of apps. If all you do is the above,
you've barely scratched the surface of "remembering my window". Things you
don't handle above:

1. Stacking remembering (relative to other things you may know nothing about
like someoene else's windows)
2. What if screen geometry (resolution, aspect ratio/scaling etc.) changed
between the last time you ran and now? are you going to re-implement logic e.g.
to scale the position and size or choose an anchor closest (corners, centers
etc.) then position relative to those?
3. Collision avoidance - what if other windows of other apps all want to open up
in the same place and make a mess?
4. What about remembering the right screen to be on? What if monitors were
plugged/unplugged since last time?
 ...

You little logic above begins to become rather complex needing information it
doesn't even have and can't get. The point of Wayland is to move this into
where it belongs - the compositor, that has a view of everything and should get
this right in one place.

Ultimately your beef might be with your desktop/compositor of choice not
remembering for you or not doing it well (or perhaps naming on your part).

> Other applications I have made include a customizable LCD clock that runs
> at startup and places itself "where I want it"
> 
> And a program called Desktop-ish that shows .desktop file folders I can
> customize/add and has many features like customizable menus I have added
> many many things to that are very useful to me.
> 
> This also places itself "where I want it"

People have abused the ability to place custom windows (in X11 often
override-redirect) anywhere they like to adhoc do this over the years ...
err.. decades. I've done it. Many times. It's always led to a mess. You are
trying to create desktop gadgets and these often belong in sensible places.
The file manager that is an integral part of the desktop env  would need to
organize "desktop" layer gadgets along with file icons sensibly. You can't have
a free-for-all. Maybe the gadget should stick in some panel or menu bar? There
are better solutions for a lot of this - like "systray" (status notifier) and
probably need to be more of these specific solutions.

> My Linux is very personalized and works very well for my needs. (It's
> awesome 😎)

This hacking only goes so far before it hits a wall. I know. I've been there
and done that. Decades ago. You then eventually move on to realize your
solutions involve fixing the WM/compositor/desktop you work with and not "hack
around it". You may end up building your own.

> The same could probably be said for many gambas coders.
> 
> Now Wayland has come along and seems to be...
> "you can no longer control window placement, deal with it, why even want
> it?, we decided you don't need it"
> 😕

Correct. Decades of experience specifically in just this field has taught the
people designing this to not re-create the problems of the past just for the
sake of compatibility for some relatively niche things. For every feature you
think here is good, it leads to a much bigger problem space of badness and
decades of history has taught that lesson.

> It is unacceptable for the many who have customized their Linux world with
> their own work.
> 
> There is worry in our community that Wayland is going to take over and x11
> will become obsolete.

It's inevitable. We're just arguing on timescales (I think Wayland will need
more time to mature but it'll get there).

> And because nobody at Wayland seems to care to provide a means of placement
> choice, should you want/need it.
> 
> I hope you understand.

We understand... better than you know. As someone who has built all the things
you are complaining about... Many times over... I agree with the Wayland
approach. I've sat on all sides of this fence. The  WM/compositor side, the app
and toolkit side. I've written them all and Wayland is making the right choices.

> > The Wayland philosophy on this has been that the compositor knows best
> > where
> > to place the windows for regular applications. That does not include fixed
> > desktop components, such as the task bar or desktop wallpapers, but those
> > need
> > to communicate directly with the compositor they are a desktop for.
> >
> 
> For the most part, sure why not?
> 
> For the case detailed above. Most definitely not mine and many others
> philosophy.

See above. :) It's the compositors job to invisibly do what you want - remember
where to put your windows. It's your job to make this sane/possible with
sensible unique naming.

> > Someone may have said they had a need to grab the keyboard and obtain key
> > events even when the window wasn't focused. But why is that? X11 uses
> > keyboard-grabbing to implement dismissal of popup menus, something that
> > Wayland solved properly instead. Another use-case was to ensure that focus
> > couldn't be stolen while typing a password... again, Wayland can solve
> > that by
> > the window describing itself as "I'm recording a password" so the
> > compositor
> > can implement a higher focus-stealing threshold or other
> > attention-grabbing
> > techniques (how many of us have typed passwords in the wrong window?).
> >
> > Other things are done for security: you can't inject events into other
> > windows, so we lose the auto-type feature in KeyPassXC. You can't perform
> > arbitrary screengrabs any more, but instead screensharing applications
> > must
> > ask the compositor to let the user choose which window(s) to share.
> >
> > --
> > Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> >    Principal Engineer - Intel DCAI Cloud Engineering
> >
> 
> Yes I forgot the screen grabs not being available is a downgrade for us.
> For example simple colour picker routines many of us have don't work now.
> Eg.
> PickedColour = Desktop.Screenshot(Mouse.x, Mouse.y).Image[0, 0]

Yup - but there are good privacy/security reasons for this. The old world of
X11 didn't give a hoot about this. These days people do. Imagine all the people
going "I remember the days of clear-text internet protocols. I just had to
sniff the wire and I could inspect what was going on and shape/route traffic
based on content". Now everyone goes "No - we encrypt it - no more of that for
you. Too bad". Priorities have changed. Wayland is built/designed to allow for
a world where every app on your desktop is not fully trusted to be "nice". It's
is hard to undo designs without breaking a lot. It's easier to carefully open
up specific features on an as-needed basis where really needed.

> It was that simple.
> 
> Mostly Wayland seems okay.
> But paranoid it seems as mostly citing "security" for all it's misgivings.
> I'm not a govt agency my computer has no nasty secrets I need to hide and
> is secure enough for me.

You might not be, but you may run some app you download from some random place
on the internet you THINK is nice (some sodoku game trinket thing) but it's
actually trying to steal your banking details... This is only getting worse in
a world of snaps/flatpaks ... See above. It's easier to design to be
restrictive first then solve the specific special cases of need carefully than
be unrestricted and then clamp down. And it's not just about security. It's
about handling all the cases you don't think of (see above the remembering
size/position - if you only thought that far, then you didn't think enough).

>  I hope you understand our dilemma here.
> 
> With respects
> Bruce Steers


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



More information about the wayland-devel mailing list