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
This commit is contained in:
committed by
Tobias Fella
parent
a29ec0a18a
commit
24644887e0
10
src/main.cpp
10
src/main.cpp
@@ -24,6 +24,7 @@
|
||||
#include <KDBusService>
|
||||
#endif
|
||||
#ifdef HAVE_WINDOWSYSTEM
|
||||
#include <kwindowsystem_version.h>
|
||||
#include <KWindowSystem>
|
||||
#endif
|
||||
#include <KLocalizedContext>
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user