File indexing completed on 2024-05-05 17:43:52

0001 /*
0002     SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #include <QGuiApplication>
0008 #include <QSessionManager>
0009 
0010 #include <KWindowSystem>
0011 
0012 #include "menuproxy.h"
0013 
0014 int main(int argc, char **argv)
0015 {
0016     qputenv("QT_QPA_PLATFORM", "xcb");
0017 
0018     QGuiApplication::setDesktopSettingsAware(false);
0019 
0020     QGuiApplication app(argc, argv);
0021 
0022     if (!KWindowSystem::isPlatformX11()) {
0023         qFatal("qdbusmenuproxy is only useful XCB. Aborting");
0024     }
0025 
0026     auto disableSessionManagement = [](QSessionManager &sm) {
0027         sm.setRestartHint(QSessionManager::RestartNever);
0028     };
0029     QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
0030     QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
0031 
0032     app.setQuitOnLastWindowClosed(false);
0033 
0034     MenuProxy proxy;
0035 
0036     return app.exec();
0037 }