228 points · by LorenDB · 1y ago · 138 comments
Read the first paragraph and it was really confusing. Still the same after reading it again.
Until I looked at the title. Oh, window activation is what we are actually talking about.
"Methodology of Window Management": http://www.chilton-computing.org.uk/inf/literature/books/wm/...
By F R A Hopgood, D A Duce, E V C Fielding, K Robinson, A S Williams. 29 April 1985. This is the Proceedings of the Alvey Workshop at Cosener's House, Abingdon that took place from 29 April 1985 until 1 May 1985. It was input into the planning for the MMI part of the Alvey Programme. The Proceedings were later published by Springer-Verlag in 1986.
My favorite chapters:
"Ten Years of Window Systems - A Retrospective View" by Warren Teitelman: http://www.chilton-computing.org.uk/inf/literature/books/wm/...
"SunDew - A Distributed and Extensible Window System" by Games Gosling: http://www.chilton-computing.org.uk/inf/literature/books/wm/...
"User Interface Working Group Discussions": http://www.chilton-computing.org.uk/inf/literature/books/wm/...
"User Interface Working Group Final Report": http://www.chilton-computing.org.uk/inf/literature/books/wm/...
I don't know about this particular issue, but for example, KiCAD has multiple issues with wayland being overly protective: [0]. For example KiCAD needs the ability to move cursor to provide good user experience. KiCAD needs the ability to move and place windows wherever it likes. KiCAD needs to control focus. KiCAD needs to prevent OpenGL throttling on inactive windows. These issues led KiCAD developers to reduce support for Wayland configurations to a bare minimum.
So it's a delicate balance for operating systems to both allow powerful apps to implement complicated UI and to prevent badly written apps to do inconvenient things.
[0]: https://www.kicad.org/blog/2025/06/KiCad-and-Wayland-Support...
As a user of KiCAD, I have not found any need for it to automatically move cursors or windows around (nor do I even remember such behaviour pre-wayland, so it can't have been important), but note that the cursor-warp protocol is coming to allow the former, and window tags are coming to allow things like window placement restoration, which should help where this may benefit UX.
Technical note, OpenGL is for rendering, which is unrelated to presentation. Window managers and display servers have no part in that process. It's the Window System Integration (WSI) if used, such as EGL or Vulkan WSI, and in the old days GLX, that talk to the display server.
Wayland only provides an optional suggestion for when it is a good time for a window to render for good frame pacing, latency and performance without the app having a full proper frame scheduling implementation itself. The issue that tends to crop up is that EGL, a WSI often used with OpenGL in apps not using a toolkit, when specifically told to block and wait for next frame, has been internally implemented to use the optional suggestion which is not provided for invisible windows.
Stuff is being done to solve this, and it doesn't affect applications that do not ask to block on updates (say, firefox), nor applications leaving this up to a toolkit (say, Gtk or Qt) or just a different window system integration than EGL (which is extremely limited on its own anyway).
Well, the first thing you do with KiCAD is scrolling to zoom in and out, and KiCAD scroll works in a way to jump cursor to the center, so you basically can pan and scroll at the same time. That's default behaviour unless you changed it in the settings, and, obviously, it needs to warp cursor to the center of the window.
> KiCAD needs the ability to move cursor to provide good user experience.
Most applications are implementing pointer warping using pointer-constraints-unstable-v1. This lets you confine the pointer to a region, at which point you can use relative events to get movement, render the cursor yourself and do whatever you want. There is the locked_pointer_v1::set_cursor_position_hint function to allow one to set the location where the cursor should be released at when the constraint is lifted, which should make everything seamless.
And sure, it might actually be that pointer-constraints-unstable-v1 isn't enough for KiCAD's particular UX somehow, maybe they need pointer-warp-v1 or something even more advanced. However, applications generally don't need to set the mouse position to arbitrary locations on-screen at any time... That is a useful capability for something doing automation, but it should really not be needed for general application development.
> KiCAD needs the ability to move and place windows wherever it likes.
KiCAD isn't a window manager, it's a damn EDA tool. I do agree that Wayland needs to provide multi-window applications with better tools to hint to the compositor what to do with window placement and especially to save and restore window positions, but this doesn't translate to "applications need to be able to decide where exactly windows go." There is basically no behavior which literally requires this, and certainly no sane behavior that requires this.
Having every application perform its own sort of logic to decide where windows go is a mess everywhere it exists. It would be cleaner and better for users if we could just figure out what sorts of higher level tools applications need for good UX and try to build around that. In most cases merely being able to position windows relative to each-other is enough. (You can obviously do this in Wayland already to some extent, though I'm sure there are missing tools that are needed.)
On Wayland today, applications can't absolutely control window placement, or even know where they are on screen. There really isn't even a global window coordinate space to even leak to applications. It's a pretty radical departure from almost everything else, so yeah, application developers are obviously not thrilled about having to deal with it. But on the other hand, it's probably the right way to go. Just because ability to control absolute positions is convenient does not mean it is necessarily the right way to go, especially if you can provide higher level tools that encode intent better and let the user decide how your application's intent should be interpreted.
> KiCAD needs to control focus.
Honestly I have no clue what they're complaining about with focus. It's too vague.
If your application is in the foreground, you can grab an activation token and use it, so even with "extreme" focus protection, there should not be any issues with KiCAD being able to focus its own windows.
As for other software being able to focus itself from KiCAD, well, this article describes how you do it. It's pretty straight-forward and it's not obvious how you would misuse it. Pretty sure the same protocol exists in X11 as well.
They're also talking about modals, which might be related to their complaints. The xdg-dialog-v1 protocol (supported in KDE 6.4, GNOME 48, and used by Qt 6.8+) gives applications the ability to mark dialogs as modals. It is a bit crazy that it took as long as it did for this to become supported by everything, but it did cross the finish line. On Ubuntu 25.04, for example, you should get GNOME 48 and Qt 6.8.
> KiCAD needs to prevent OpenGL throttling on inactive windows
OpenGL isn't throttled, it is stalled if the window is entirely occluded. You can now resolve this issue with the fifo-v1 protocol and Mesa 25.0 or newer. For example, Ubuntu 25.04 ships Mesa 25.x and GNOME 48 which has fifo-v1. fifo-v1 is also available in KDE as of 6.4.
This should give applications the frame pacing behavior that they want. It is possible to work around the issue to some degree, it's just annoying.
If KiCAD developers don't want to support Wayland because it's effort they'd rather spend on other shit then fine, XWayland should mostly continue to work as-expected anyways. Best option for now is to force KiCAD to use X11, like Krita does. I'm sure that's not a 100% panacea but it should be good enough especially if KiCAD is so buggy on Wayland that it actively crashes.
It's also a conglomerate of executables, so focus transfer often won't be between windows in the same process, but windows in different processes.
[1]: https://forum.kicad.info/t/what-is-the-future-of-wxwidgets/2...
That attitude is the problem, I think.
The functionality in question is irrelevant. What is relevant is that, presumably, Windows and Mac and X11 users of Kicad use this functionality.
The onus is on the Wayland team to justify the decision to take away a feature currently in use, not on the user base to justify switching to another system.
> "applications need to be able to decide where exactly windows go." There is basically no behavior which literally requires this, and certainly no sane behavior that requires this.
I just had a thought. Whenever I pop-up a child dialog (incl. message boxes) in a desktop UI app, I normally (1) center it over the parent window, or (2) place to the right of the parent window so that many layers of blocking child dialogs common in complex config settings build a "UI train" from left to right. In both cases, I am using "pixel perfect" placement of these windows. I never had any users complain about it. Is this not a valid use case?I don't know what KiCAD is, but it certainly does not need to control focus OS wide. Only between its own windows.
It's probably not KiCAD's fault that the windowing system doesn't work like that, but still...
> Unpredictable window focus behavior that can interrupt workflows
Which isn't exactly the same issue, so indeed it doesn't need to control focus.
(Though this permission may be display server-dependent, as it may not make sense in case of each).
https://developer.apple.com/videos/play/wwdc2023/10054/?time...
I can think of two real world examples: (1) debugger hits breakpoint and steals focus (this is sometimes configurable), (2) WiFi needs re-/auth.
For the debugger use case: If the IDE has already focus, it can pass an activation token to the debugger and the debugger can use this to focus itself. If the IDE is not focused, I don't want the debugger to steal focus.
Wait, what? Hasn't Windows prevented focus stealing for literally decades at this point?
https://devblogs.microsoft.com/oldnewthing/20090220-00/?p=19...
So many times on X11 do I type some chat message, and then some popup from another program comes up, which I accidentally confirm by my typing containing a space which presses the confirmation button, and I don't even know what the popup was.
Or my password being typed in a popup.
I once patched some code into i3 to prevent this for myself, but it wasn't a clean solution.
Even on "Low" (the options are None, Low, Medium, High, Extreme) I'm not seeing this behavior. Might be an i3 problem.
You said "mechanism seems worth it". While there seems to be some work on extending it, this is not a new mechanism. A hypothetical i3 port to Wayland might very well have the same behaviour you dislike. (I wouldn't categorise sway as a port, rewrite seems more like it.)
sleep 2 && zenity --entry --text="Enter text:"
and switch to a different workspace where you start typing.The popup of the other program should appear and capture your input.
As far as I know, i3 has no prevention for that.
(In this example I'm spawning a program delayed to demonstrate that, but the same can happen to e.g. the gpg-agent password prompt popping up when an SSH connection that uses it reconnects, a chat window from an IM program, and so on. I think the idea of Wayland window activation / focus stealing prevention is that you can still have those windows pop up, but without them taking your input.)
Now there may be a legitimate case to steal focus, but I am unable to think of one at the moments and your click link example fails to convince me.
I also sort of hate modal dialogs/windows. I think modals are in general an indicator of lazy/bad design. That being said, there are legitimate cases for modals. but "stop the world and handle me" should be a last resort not the first.
In purely software spaces there's usually nothing that urgent happening. If something is really urgent it's usually going to be because it carries significant real-world consequences. Emergency alerts on smartphones are a good example of taking immediate priority over all other activities, especially if it's something like a warning of incoming missiles.
Can't even say "browsers are allowed to grab focus" because they'll grab it for a stupid window telling you to update the browser or what new features no one cares about they introduced.
I'd prefer to have to switch focus to the browser manually than have the stupid ubuntu update manager steal focus when i'm typing in the terminal...
It isn't perfect, because there's no way to know that the browser isn't using the token to request focus for something else, but maintaining and validating chain of custody for focus across applications is exactly the problem it looks like they are working on solving.
To my understanding, the approach described in the article is that the currently active program requests a token and then passes that along to the program that it wants to take focus. Compositor can also check what triggered the request (mouse click? global keybind?) to decide if the request is legitimate.
That seems reasonable to me, opposed to requiring the user to switch over to a new window every time they `right click -> show in file browser` a file in their IDE, or after they press a hotkey to open a screenshot tool, or so on.
To be fair, the same is mostly true on Windows, but through some different APIs.
Applications being able to put themselves in front unconditionally was for a long time a huge source of pain for the user, due to abusive/malicious software, and probably a reason Windows was malware platform #1.
This is honestly a reasonable design.
In some cases this had to get past QA at two billion-dollar companies, and neither did something about it.
But that's far from the only way we've regressed in software quality. Really not worth mentioning. A drop of piss in an ocean of sewage.
I'm glad that at least on my actual computer I get to focus on work distraction free - likely because most of the software running on there is designed by its users and survived by merit, rather than being the brainfart of some corporate committee more concerned with other things.
Type-type-type...HEY THIS APPLICATION HAS SOME UPDATES HERES A CHANGEL-keypress closes window
I wanted to read that, damn it!
The power of a system allows one -near infinite- ability to create and manipulate those mechanisms, systems, and strategies.
The most powerful systems have few safeguards or rails, and user beware.
The most restrictive systems we hand to grandma and grandpa, knowing there is little they can actually do with them.
You must not use Windows where every application comes with its own auto-updater, often stealing focus and minimizing your game once when the updater pops up, and then again when it restarts the main application it just updated.
Devs can't be trusted to not turn their users homicidal. Someone has to stop them for their own good.
…I thought {not allowing,managing} this on X11 is the window manager's job? (kwin certainly doesn't allow it on my X11 session…)
Or is this arguing about "uncooperative"/"hostile" applications?
But yeah, it has happened to me too, too often for it to be a problem. Especially the press the space bit.
I am not sure this is the right solution, however, but I cannot think of any solution right now.
Someone (in the comments) who has claimed to patch i3 may shed some light on what he did.
why cant linux guys just... copy windows?
android-ifying this space with permissions, channels, protocols etc, and pretending that apps are insecure is adding friction that benefits nobody imo.
A proper solution is probably faster startup times, but overall it pretty much never happens? Idk maybe I'm lucky or just conditioned to ignore it.
Maybe an auto-updater will do this, and if it happened with any frequency I might disable those autoupdates and try a macro-based (e.g. Keyboard Maestro) solution.
It's infuriating.
Not really, as proven by the amount of searches with "Windows 11 disable focus stealing" (and ensuing frustration after seeing that it's not a simple toggle somewhere in the Settings) that I've done over time, and confirmed with so many coworkers over the years that we'd like to disable it.
Windows in particular and computers in general, work as they do, and people just adapt to it and sigh in frustration, assuming that things must be that way and there's nothing that can be done to change it. It's difficult to measure "Just Works" if there are no satisfaction surveys for each feature (also would be impractical). Focus stealing in particular is so ingrained in people's minds that I doubt many are even aware that it could work differently.
Linux is already set up to handle this better than Windows actually since most apps are open source and abusive window management is likely to result in PRs.
These days however, the negligence of the current custodian, Red Hat, does seem to border on malicious, especially when forks like XLibre are continuing to patch vulnerabilities while Red Hat refuses to merge patches into the "official" X11, as part of a coercive strategy of trying to force all users onto Wayland by allowing X11 to become even worse through active refusal and neglect to merge good PR's with security patches, despite being the official project owner and custodian.
As a final note, I did not say that Windows and Mac OS were spyware, I said they were functionally spyware. There's a meaningful and nuanced difference between those two claims that I'm not sure you are discerning in accordance with my intent.