Bug 496365 - activateWindow doesn't work in Qt 5 app running in Plasma 6 Wayland
Summary: activateWindow doesn't work in Qt 5 app running in Plasma 6 Wayland
Status: RESOLVED FIXED
Alias: None
Product: plasma-integration
Classification: Plasma
Component: general (show other bugs)
Version: 6.2.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-17 00:45 UTC by equeim
Modified: 2024-11-25 14:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description equeim 2024-11-17 00:45:43 UTC
SUMMARY
KWindowSystem::activateWindow() called from Qt 5 application running in Plasma 6 Wayland environment does nothing.

"QWindow::fromWinId(): platform plugin does not support foreign windows." warning is seen in stderr.

STEPS TO REPRODUCE
1. Run Qt 5 application using KWindowSystem::activateWindow() function in Plasma 6
2. Make it so it's called

OBSERVED RESULT
Window is not activated, warning is seen in stderr.

EXPECTED RESULT
Window is activated through xdg-activation protocol

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 20241114
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 5.116.0
Qt Version: 5.15.15+kde127

ADDITIONAL INFORMATION
This is probably somehow related to this change: https://github.com/KDE/kwayland-integration/commit/f2f14df48616f31bee62d3f57d9f08278aa8888d#diff-a1327a30e90efe63958cf1f12637a94e2a7e5fc93996bd96664ba001d8626ea9L66
Comment 1 Nate Graham 2024-11-19 19:05:06 UTC
I'm afraid KF5 is no longer developed, so there's not much hope of this being fixed for KF5-using apps.
Comment 2 equeim 2024-11-19 19:06:06 UTC
(In reply to Nate Graham from comment #1)
> I'm afraid KF5 is no longer developed, so there's not much hope of this
> being fixed for KF5-using apps.

But the Wayland plugin for KF5WindowSystem is actually part of Plasma 6, no?
Comment 3 Nate Graham 2024-11-20 20:25:46 UTC
If the issue on that side of it, yes. If it requires changes on the other side, then no. CCing some some people more intelligent than me who can probably help make that determination.
Comment 4 Bug Janitor Service 2024-11-20 22:25:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-integration/-/merge_requests/66
Comment 5 Nicolas Fella 2024-11-25 14:19:53 UTC
Git commit d7d9c1bb4b3a1c5d65137334cb4e6472211c2a16 by Nicolas Fella.
Committed on 25/11/2024 at 14:00.
Pushed by nicolasfella into branch 'master'.

Fix obtaining wl_surface from WId

f2f14df48616f31bee62d3f57d9f08278aa8888d ported from KWayland::Surface::fromQtWinId
to QWindow::fromWinId, but QWindow::fromWinId doesn't work on Wayland.

Instead copy the implementation from KWayland and use that

M  +25   -1    src/windowsystem/windowsystem.cpp

https://invent.kde.org/plasma/kwayland-integration/-/commit/d7d9c1bb4b3a1c5d65137334cb4e6472211c2a16
Comment 6 Nicolas Fella 2024-11-25 14:20:01 UTC
Git commit 0bd61486dec73c515708e944c99d1f6b4cb77164 by Nicolas Fella.
Committed on 25/11/2024 at 14:00.
Pushed by nicolasfella into branch 'master'.

Initialize xdg activation

Otherwise it only works the second time we try to use it

M  +1    -0    src/windowsystem/waylandxdgactivationv1.cpp

https://invent.kde.org/plasma/kwayland-integration/-/commit/0bd61486dec73c515708e944c99d1f6b4cb77164
Comment 7 Nicolas Fella 2024-11-25 14:23:16 UTC
Git commit 5a47aa1159d31c1998d3a2addde2266226a2cb23 by Nicolas Fella.
Committed on 25/11/2024 at 14:20.
Pushed by nicolasfella into branch 'Plasma/6.2'.

Initialize xdg activation

Otherwise it only works the second time we try to use it
(cherry picked from commit 0bd61486dec73c515708e944c99d1f6b4cb77164)

M  +1    -0    src/windowsystem/waylandxdgactivationv1.cpp

https://invent.kde.org/plasma/kwayland-integration/-/commit/5a47aa1159d31c1998d3a2addde2266226a2cb23
Comment 8 Nicolas Fella 2024-11-25 14:23:24 UTC
Git commit 1432f93ed23dd73f7f9a9606da4bb5cf531a8ed9 by Nicolas Fella.
Committed on 25/11/2024 at 14:20.
Pushed by nicolasfella into branch 'Plasma/6.2'.

Fix obtaining wl_surface from WId

f2f14df48616f31bee62d3f57d9f08278aa8888d ported from KWayland::Surface::fromQtWinId
to QWindow::fromWinId, but QWindow::fromWinId doesn't work on Wayland.

Instead copy the implementation from KWayland and use that
(cherry picked from commit d7d9c1bb4b3a1c5d65137334cb4e6472211c2a16)

M  +25   -1    src/windowsystem/windowsystem.cpp

https://invent.kde.org/plasma/kwayland-integration/-/commit/1432f93ed23dd73f7f9a9606da4bb5cf531a8ed9