Commit fb999535 authored by David Edmundson's avatar David Edmundson Committed by Christoph Cullmann
Browse files

wayland fix window activation

Kate has it's own version of org.freedesktop.Application spec and
KDBusAddons handling. It needs to pass the activation token explicitly.

The launched (second) instance will have an environment variable
XDG_ACTIVATION_TOKEN set, we need to pass this value to the existing
application before it can set the window to activate.

Testing done: clicked on a file in dolphin, kate got focus
parent 50986efe
Pipeline #91596 passed with stage
in 4 minutes and 2 seconds
......@@ -28,7 +28,7 @@ KateAppAdaptor::KateAppAdaptor(KateApp *app)
{
}
void KateAppAdaptor::activate()
void KateAppAdaptor::activate(const QString &token)
{
KateMainWindow *win = m_app->activeKateMainWindow();
if (!win) {
......@@ -43,6 +43,7 @@ void KateAppAdaptor::activate()
// try to raise window, see bug 407288
win->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(win->windowHandle(), KStartupInfo::startupId());
KWindowSystem::setCurrentXdgActivationToken(token);
KWindowSystem::activateWindow(win->effectiveWinId());
}
......
......@@ -94,7 +94,7 @@ public Q_SLOTS:
/**
* activate this kate instance
*/
void activate();
void activate(const QString &token = QString());
Q_SIGNALS:
/**
......
......@@ -563,6 +563,7 @@ int main(int argc, char **argv)
QStringLiteral("/MainApplication"),
QStringLiteral("org.kde.Kate.Application"),
QStringLiteral("activate"));
activateMsg.setArguments({qEnvironmentVariable("XDG_ACTIVATION_TOKEN")});
QDBusConnection::sessionBus().call(activateMsg);
// connect dbus signal
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment