From 24644887e0d44db79235f7537c6b0ee84f22ff00 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Mon, 3 Jan 2022 00:45:16 +0100 Subject: [PATCH] Modernize code to activate window on user activation * use KWindowSystem::updateStartupId() for abstract update of X11 startup id or wayland activation token * call QWindow::raise() also for wayland to prepare when it will support it * call KWindowSystem::activateWindow() for all platforms, like done by other apps on user-triggered activation --- src/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d0970694d..1d21a90b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,7 @@ #include #endif #ifdef HAVE_WINDOWSYSTEM +#include #include #endif #include @@ -78,12 +79,15 @@ using namespace Quotient; #ifdef HAVE_WINDOWSYSTEM static void raiseWindow(QWindow *window) { +#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 91, 0) + KWindowSystem::updateStartupId(window); +#else if (KWindowSystem::isPlatformWayland()) { KWindowSystem::setCurrentXdgActivationToken(qEnvironmentVariable("XDG_ACTIVATION_TOKEN")); - KWindowSystem::activateWindow(window->winId()); - } else { - window->raise(); } +#endif + KWindowSystem::activateWindow(window->winId()); + window->raise(); } #endif