Summary: | Launching some gtk3 apps on wayland causes error | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Marko Gobin <gobonja> |
Component: | effects-overview | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde, nate, nicolas.fella |
Priority: | NOR | ||
Version: | 5.24.1 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/frameworks/kwindowsystem/commit/8d580e2fa466fdb47a82a19f42ba78424f424c41 | Version Fixed In: | 5.92 |
Sentry Crash Report: | |||
Attachments: | error |
Description
Marko Gobin
2022-02-15 20:40:22 UTC
This is most likely related to the DBus-activation support in KIO::ApplicationLauncherJob However kstart5 --application org.gnome.Calendar works fine, so it seems somewhat kwin-specific QDBusError("org.freedesktop.DBus.Error.UnknownMethod", "Method \"Activate\" with signature \"a{sv}\" on interface \"org.freedesktop.Application\" doesn't exist\n") Happens only when called from kwin_wayland indeed It looks like "Activate" is called twice: QDBusMessage(type=MethodCall, service="", path="/", interface="org.freedesktop.Application", member="Activate", signature="", contents=() ) QDBusMessage(type=MethodCall, service="org.gnome.Calendar", path="/org/gnome/Calendar", interface="org.freedesktop.Application", member="Activate", signature="", contents=() ) when using kstart5 it's only once: QDBusMessage(type=MethodCall, service="org.gnome.Calendar", path="/org/gnome/Calendar", interface="org.freedesktop.Application", member="Activate", signature="", contents=() ) Oh this is a fun one. Here's what happens: - Kwin/overview use KIO::ApplicationLauncherJob to launch the app - ApplicationLauncherJob finds that the target supports DBus activation - ApplicationLauncherJob notices we are on Wayland and requests an XDG activation token: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L313. It connects the token arriving to launching the app - Further down it sets which app should be launched: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L320 - Further down it starts the app when we are not waiting for a token: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L343 So far so good. So why does it fail only in kwin_wayland? Usually the token arrives asynchronously, so the app is already set and it launches fine. However, in KWindowSystem::requestXdgActivationToken there is a check for KWindowSystemPrivateV2, and if that fails it directly emits xdgActivationTokenArrived: https://invent.kde.org/frameworks/kwindowsystem/-/blob/master/src/kwindowsystem.cpp#L819 This makes the token arrival no longer async and all the slots are triggered directly (since it's not a queued connection), which leads to the app being launched before m_service is set. boom And why does the check fail? because kwin has its own kwindowsystem plugin that doesn't implement V2 of the interface A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/49 Another obvious fix would be to implement V2 of the interface in kwin, but not sure whether having a correct activation token is even important here I think it is relevant for activating running instances of single-window apps from the overview? Git commit 8d580e2fa466fdb47a82a19f42ba78424f424c41 by Nicolas Fella. Committed on 15/02/2022 at 22:30. Pushed by nicolasfella into branch 'master'. Ensure that xdgActivationTokenArrived is always emitted asynchronously Otherwise consumers that expect it to be async break M +6 -1 src/kwindowsystem.cpp https://invent.kde.org/frameworks/kwindowsystem/commit/8d580e2fa466fdb47a82a19f42ba78424f424c41 |