Fix wayland activation
Adds support for xdg_activation_v1 when calling the application from the system tray by using KStatusNotifier which supports it. Listens to XDG_ACTIVATION_TOKEN as it's passed when we are started from dbus.
This commit is contained in:
committed by
Aleix Pol Gonzalez
parent
5c86692fb5
commit
265fcbfead
15
src/main.cpp
15
src/main.cpp
@@ -22,6 +22,7 @@
|
||||
#include <KAboutData>
|
||||
#ifdef HAVE_KDBUSADDONS
|
||||
#include <KDBusService>
|
||||
#include <KWindowSystem>
|
||||
#endif
|
||||
#include <KLocalizedContext>
|
||||
#include <KLocalizedString>
|
||||
@@ -66,6 +67,18 @@
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
#ifdef HAVE_KDBUSADDONS
|
||||
static void raiseWindow(QWindow *window)
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
KWindowSystem::setCurrentXdgActivationToken(qEnvironmentVariable("XDG_ACTIVATION_TOKEN"));
|
||||
KWindowSystem::activateWindow(window->winId());
|
||||
} else {
|
||||
window->raise();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
Q_DECL_EXPORT
|
||||
#endif
|
||||
@@ -232,7 +245,7 @@ int main(int argc, char *argv[])
|
||||
auto view = qobject_cast<QQuickWindow *>(obj);
|
||||
if (view) {
|
||||
view->show();
|
||||
view->raise();
|
||||
raiseWindow(view);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user