It does this: const auto &windows = WaylandIntegration::self()->plasmaWindowManagement()->windows(); auto it = std::find_if(windows.begin(), windows.end(), [wid] (PlasmaWindow *w) { return w->internalId() == wid; } ); wid is the internally generated window id in the client process, while internalId() returns the internally generated window id from the compositor. Those do not match, which essentially means that any KWindowSystem functions on wayland which take a WId act on a random window instead. krunner for instance calls KWindowSystem::forceActiveWindow(winId()); after the window is shown, but actually activates the desktop (plasmashell) instead. krunner's View is the first QWaylandWindow instance and gets winId 1, while plasmashell is the first window created by kwayland-server.
At least it's found. As for this bug - we definitely need to fix krunner. Super worst case, we just if guard round that call. As for this bug, I think the right call is to strip all plasmaWindowManagement from kwayland-integration to leave only things that meddle with our windows not 3rd party windows. It's a broken concept to try and retroactively fit into our old API. Only plasma should meddle with other windows, and we have native API for that so should have no regressions.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-integration/-/merge_requests/6
Git commit 9058eff75d11e112ccf35f723199dd458fa7b02e by Fabian Vogt. Committed on 03/05/2021 at 09:01. Pushed by fvogt into branch 'master'. Drop functions which rely on PlasmaWindow::internalId() While that returns a WinId, those are from the compositor and not related to the internal WinIds from the calling application itself. Most uses of KWindowSystem rely on that though, and so acted on a random other window instead. M +0 -21 src/windowsystem/waylandintegration.cpp M +19 -85 src/windowsystem/windowsystem.cpp M +0 -4 src/windowsystem/windowsystem.h https://invent.kde.org/plasma/kwayland-integration/commit/9058eff75d11e112ccf35f723199dd458fa7b02e