Kwin 6.5 beta weird focus behaviour

Hi,

I installed plasma 6.5 beta, and kwin’s window focus behaviour changed in a bad way.

First the set up (what I thought of that might be relevant):

Window activation policy - focus follows mouse

Delay focus - 300ms

click raises window - enabled

raise on hover - disabled

Window placement - under mouse.

The issue:

Mainly in web browsers (both chromium and firefox) : opening a new window opens it under the current window.

Popups/new windows don’t have focus by default. (pinentry-qt6), some don’t appear under mouse (libvirt related windows, gajim’s popup. Actually the common thing between these 2 is GTK + python) .

sometimes krunner (alt+F2) won’t appear, yakuake (F12) doesn’t appear most of the time, and when it does, it’s under the active window.

it’s all a very weird experience, and I’m not sure how to report this as a useful bug report, so starting here… Any information you need, I’ll happily provide.

And all this started the moment I upgraded to the beta.

What’s your focus stealing prevention set to?

Focus stealing prevention - high

I fiddled with that because of an issue (unsolved) from 6.4 and previous:
on login, kwallet tries to open using my GPG key, and that launches pinentry-qt6. Pinentry then remains in the foreground, but its focus is stolen by all the restored windows from the previous session. This requires me to wait until all windows appear, before I focus it and enter the passphrase, hoping nothing else will pop up while I’m typing.

setting to “low” makes things work properly. Haven’t tried pinentry on login yet…
And strike the yakuake issue: “never” was actually just under fullscreen windows. All this is a focus issue, apparently…

I’m not surprised then. I implemented proper focus stealing prevention for the Wayland session, and it uncovered a mess of application issues. Most issues that we found are already fixed and waiting for new releases (like in Firefox), but some are still pending (like in Chromium). Focus stealing prevention is “low” by default until we figure out the remaining issues.

Krunner not activating I can’t explain though; that had some issues but I fixed them (with a matching autotest) before the beta. Did you notice any pattern for when it didn’t appear?

Until further issues, I’ll assume that krunner fell into the same issue as yakuake: appearing under all windows. IOW: it seems to work properly now.

With focus stealing prevention set to low, things seem to work ok.

Thank you for your work!

I’ve run into this issue with Jetbrains IntelliJ IDEA on Plasma 6.5.2 (using their experimental Wayland support) as well, with focus prevention set to Medium or above – Plasma prevents in-app popups from receiving the focus. With focus prevention set to “Low”, it works as expected.

Should I create a KDE Plasma bug for this, or this something that the Jetbrains folks need to look at?

I think it’s here: https://bugs.kde.org/show_bug.cgi?id=509990

1 Like

Acutally, now that I thought about it more, Jetbrains have their own UI toolkit, right? So I’d say they need to be notified of it too.

It’s an application bug, so please report it to Jetbrains. They can’t assume new windows to get focus, they need to use xdg activation to activate windows.

1 Like

@Zamundaaa Apparently some Jetbrains functionality that does use the XDG activation protocol is also broken on 6.5.2.

See https://youtrack.jetbrains.com/issue/JBR-9656/Wayland-project-switcher-and-Next-Previous-Project-Window-actions-do-not-work-on-KDE-Plasma-6.5.2.

Yeah, but using the protocol wrongly doesn’t really help, even if that happens to work on Gnome. I commented on that issue, hopefully it can be fixed properly.

1 Like

@Zamundaaa Thank you for commenting / explaining there. Can you also comment on https://youtrack.jetbrains.com/issue/JBR-9645, looking at the last 3 or 4 comments which talk about using the activation protocol for popups? Jetbrains is under the assumption that xdg-activation can only be used for top-level windows (per the spec), and not popups. However with 6.5.2 and Medium focus stealing prevention, popups in IDEA don’t work. If they should be using xdg-activation for popups, they might need to be educated on that. If they shouldn’t, then an alternative solution is needed.