Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/main.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This library is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
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 | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | * | ||||
18 | */ | ||||
19 | | ||||
20 | #include <QGuiApplication> | ||||
21 | #include <QSessionManager> | ||||
22 | | ||||
23 | #include <KWindowSystem> | ||||
24 | | ||||
25 | #include "menuproxy.h" | ||||
26 | | ||||
27 | int main(int argc, char ** argv) | ||||
28 | { | ||||
29 | qputenv("QT_QPA_PLATFORM", "xcb"); | ||||
30 | | ||||
31 | QGuiApplication::setDesktopSettingsAware(false); | ||||
32 | | ||||
33 | QGuiApplication app(argc, argv); | ||||
34 | | ||||
35 | if (!KWindowSystem::isPlatformX11()) { | ||||
36 | qFatal("qdbusmenuproxy is only useful XCB. Aborting"); | ||||
37 | } | ||||
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); | ||||
46 | | ||||
47 | MenuProxy proxy; | ||||
48 | | ||||
49 | return app.exec(); | ||||
50 | } |