Commit 57dc3b72 authored by David Edmundson's avatar David Edmundson
Browse files

Set startupID before raising

Otherwise it will be blocked correctly by window manager focus policies

BUG: 423857
parent 9ac2e94a
...@@ -11,7 +11,7 @@ find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) ...@@ -11,7 +11,7 @@ find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick X11Extras)
include(KDEInstallDirs) include(KDEInstallDirs)
include(KDECMakeSettings) include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
......
...@@ -36,6 +36,7 @@ target_link_libraries(plasma-discover PUBLIC ...@@ -36,6 +36,7 @@ target_link_libraries(plasma-discover PUBLIC
KF5::KIOWidgets KF5::KIOWidgets
KF5::QuickAddons KF5::QuickAddons
Qt5::Quick Qt5::Quick
Qt5::X11Extras
Discover::Common Discover::Common
) )
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include "DiscoverVersion.h" #include "DiscoverVersion.h"
#include <QTextStream> #include <QTextStream>
#include <QStandardPaths> #include <QStandardPaths>
#include <kstartupinfo.h>
#include <QX11Info>
typedef QHash<QString, DiscoverObject::CompactMode> StringCompactMode; typedef QHash<QString, DiscoverObject::CompactMode> StringCompactMode;
Q_GLOBAL_STATIC_WITH_ARGS(StringCompactMode, s_decodeCompactMode, (StringCompactMode { Q_GLOBAL_STATIC_WITH_ARGS(StringCompactMode, s_decodeCompactMode, (StringCompactMode {
...@@ -135,10 +138,18 @@ int main(int argc, char** argv) ...@@ -135,10 +138,18 @@ int main(int argc, char** argv)
} }
QObject::connect(&app, &QCoreApplication::aboutToQuit, mainWindow, &DiscoverObject::deleteLater); QObject::connect(&app, &QCoreApplication::aboutToQuit, mainWindow, &DiscoverObject::deleteLater);
QObject::connect(service, &KDBusService::activateRequested, mainWindow, [mainWindow](const QStringList &arguments, const QString &/*workingDirectory*/){ QObject::connect(service, &KDBusService::activateRequested, mainWindow, [mainWindow](const QStringList &arguments, const QString &/*workingDirectory*/){
if (!mainWindow->rootObject()) if (!mainWindow->rootObject())
QCoreApplication::instance()->quit(); QCoreApplication::instance()->quit();
mainWindow->rootObject()->raise();
auto window = qobject_cast<QWindow*>(mainWindow->rootObject());
if (window && QX11Info::isPlatformX11()) {
KStartupInfo::setNewStartupId(window, QX11Info::nextStartupId());
}
window->raise();
if (arguments.isEmpty()) if (arguments.isEmpty())
return; return;
QScopedPointer<QCommandLineParser> parser(createParser()); QScopedPointer<QCommandLineParser> parser(createParser());
......
Markdown is supported
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