File indexing completed on 2024-05-05 17:45:24
0001 /* 0002 Main 0003 SPDX-FileCopyrightText: 2015 David Edmundson <davidedmundson@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #include <QGuiApplication> 0009 #include <QSessionManager> 0010 0011 #include "fdoselectionmanager.h" 0012 0013 #include "debug.h" 0014 #include "snidbus.h" 0015 #include "xcbutils.h" 0016 0017 #include <QDBusMetaType> 0018 0019 #include <KWindowSystem> 0020 0021 namespace Xcb 0022 { 0023 Xcb::Atoms *atoms; 0024 } 0025 0026 int main(int argc, char **argv) 0027 { 0028 // the whole point of this is to interact with X, if we are in any other session, force trying to connect to X 0029 // if the QPA can't load xcb, this app is useless anyway. 0030 qputenv("QT_QPA_PLATFORM", "xcb"); 0031 0032 QGuiApplication::setDesktopSettingsAware(false); 0033 0034 QGuiApplication app(argc, argv); 0035 0036 if (!KWindowSystem::isPlatformX11()) { 0037 qFatal("xembed-sni-proxy is only useful XCB. Aborting"); 0038 } 0039 0040 auto disableSessionManagement = [](QSessionManager &sm) { 0041 sm.setRestartHint(QSessionManager::RestartNever); 0042 }; 0043 QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); 0044 QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); 0045 0046 app.setQuitOnLastWindowClosed(false); 0047 0048 qDBusRegisterMetaType<KDbusImageStruct>(); 0049 qDBusRegisterMetaType<KDbusImageVector>(); 0050 qDBusRegisterMetaType<KDbusToolTipStruct>(); 0051 0052 Xcb::atoms = new Xcb::Atoms(); 0053 0054 FdoSelectionManager manager; 0055 0056 auto rc = app.exec(); 0057 0058 delete Xcb::atoms; 0059 return rc; 0060 }