Commit 7bd76ec2 authored by Alexander Volkov's avatar Alexander Volkov

Use new simpler way to disable session management

Set Qt::AA_DisableSessionManager attribute, which is available
since Qt 5.14.
parent 9c23ef29
......@@ -19,7 +19,6 @@
#include <QGuiApplication>
#include <QDBusConnection>
#include <QSessionManager>
#include "kscreen_backendLauncher_debug.h"
#include "backendloader.h"
......@@ -29,14 +28,9 @@ int main(int argc, char **argv)
{
KScreen::Log::instance();
QGuiApplication::setDesktopSettingsAware(false);
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
QGuiApplication app(argc, argv);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
if (!QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KScreen"))) {
qCWarning(KSCREEN_BACKEND_LAUNCHER) << "Cannot register org.kde.KScreen service. Another launcher already running?";
return -1;
......
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