Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/main.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | 14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with this library; if not, write to the Free Software | 15 | * License along with this library; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | * | 17 | * | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include <QGuiApplication> | 20 | #include <QGuiApplication> | ||
21 | #include <QSessionManager> | | |||
22 | 21 | | |||
23 | #include <KWindowSystem> | 22 | #include <KWindowSystem> | ||
24 | 23 | | |||
25 | #include "menuproxy.h" | 24 | #include "menuproxy.h" | ||
26 | 25 | | |||
27 | int main(int argc, char ** argv) | 26 | int main(int argc, char ** argv) | ||
28 | { | 27 | { | ||
29 | qputenv("QT_QPA_PLATFORM", "xcb"); | 28 | qputenv("QT_QPA_PLATFORM", "xcb"); | ||
30 | 29 | | |||
31 | QGuiApplication::setDesktopSettingsAware(false); | 30 | QGuiApplication::setDesktopSettingsAware(false); | ||
31 | QCoreApplication::setAttribute(Qt::AA_DisableSessionManager); | ||||
32 | 32 | | |||
33 | QGuiApplication app(argc, argv); | 33 | QGuiApplication app(argc, argv); | ||
34 | 34 | | |||
35 | if (!KWindowSystem::isPlatformX11()) { | 35 | if (!KWindowSystem::isPlatformX11()) { | ||
36 | qFatal("qdbusmenuproxy is only useful XCB. Aborting"); | 36 | qFatal("qdbusmenuproxy is only useful XCB. Aborting"); | ||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | auto disableSessionManagement = [](QSessionManager &sm) { | | |||
40 | sm.setRestartHint(QSessionManager::RestartNever); | | |||
41 | }; | | |||
42 | QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); | | |||
43 | QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); | | |||
44 | | ||||
45 | app.setQuitOnLastWindowClosed(false); | 39 | app.setQuitOnLastWindowClosed(false); | ||
46 | 40 | | |||
47 | MenuProxy proxy; | 41 | MenuProxy proxy; | ||
48 | 42 | | |||
49 | return app.exec(); | 43 | return app.exec(); | ||
50 | } | 44 | } |