Commit 7b124f36 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Fix window raising

Raise window even when no args are passed

Use KWindowSystem API that also works on Wayland
parent 2e0aa9e3
Pipeline #178833 passed with stage
in 2 minutes and 58 seconds
......@@ -13,7 +13,7 @@ add_definitions(-D'VERSION="${RELEASE_SERVICE_VERSION}"'
-D'VERSION_MICRO=${RELEASE_SERVICE_VERSION_MICRO}')
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.89")
set (KF5_MIN_VERSION "5.91")
set (LIBKTORRENT_MIN_VERSION "20.11.70")
set (Boost_MIN_VERSION "1.71.0")
......
......@@ -220,16 +220,7 @@ int main(int argc, char **argv)
kt::GUI widget;
auto handleCmdLine = [&widget, &parser](const QStringList &arguments, const QString &workingDirectory) {
if (!arguments.isEmpty()) {
parser.parse(arguments);
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 62, 0)
widget.setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(widget.windowHandle(), KStartupInfo::startupId());
#else
KStartupInfo::setNewStartupId(&widget, KStartupInfo::startupId());
#endif
KWindowSystem::forceActiveWindow(widget.winId());
}
parser.parse(arguments);
QString oldCurrent = QDir::currentPath();
if (!workingDirectory.isEmpty())
QDir::setCurrent(workingDirectory);
......@@ -246,7 +237,14 @@ int main(int argc, char **argv)
QDir::setCurrent(oldCurrent);
};
QObject::connect(&dbusService, &KDBusService::activateRequested, handleCmdLine);
QObject::connect(&dbusService, &KDBusService::activateRequested, &widget, &kt::GUI::show);
QObject::connect(&dbusService, &KDBusService::activateRequested, &widget, [&widget] {
if (!widget.isVisible()) {
widget.show();
} else {
KWindowSystem::updateStartupId(widget.windowHandle());
KWindowSystem::activateWindow(widget.windowHandle());
}
});
handleCmdLine(QStringList(), QString());
app.setQuitOnLastWindowClosed(false);
......
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