Changeset View
Changeset View
Standalone View
Standalone View
shell/main.cpp
Show All 34 Lines | |||||
35 | #include <klocalizedstring.h> | 35 | #include <klocalizedstring.h> | ||
36 | #include <kcrash.h> | 36 | #include <kcrash.h> | ||
37 | #include <kworkspace.h> | 37 | #include <kworkspace.h> | ||
38 | 38 | | |||
39 | #include "shellcorona.h" | 39 | #include "shellcorona.h" | ||
40 | #include "standaloneappcorona.h" | 40 | #include "standaloneappcorona.h" | ||
41 | #include "shellmanager.h" | 41 | #include "shellmanager.h" | ||
42 | #include "coronatesthelper.h" | 42 | #include "coronatesthelper.h" | ||
43 | #include "softwarerendernotifier.h" | ||||
43 | 44 | | |||
44 | #include <QDir> | 45 | #include <QDir> | ||
45 | 46 | | |||
46 | int main(int argc, char *argv[]) | 47 | int main(int argc, char *argv[]) | ||
47 | { | 48 | { | ||
48 | //Plasma scales itself to font DPI | 49 | //Plasma scales itself to font DPI | ||
49 | //on X, where we don't have compositor scaling, this generally works fine. | 50 | //on X, where we don't have compositor scaling, this generally works fine. | ||
50 | //also there are bugs on older Qt, especially when it comes to fractional scaling | 51 | //also there are bugs on older Qt, especially when it comes to fractional scaling | ||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 177 | auto message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"), | |||
178 | QStringLiteral("org.qtproject.Qt.QCoreApplication"), | 179 | QStringLiteral("org.qtproject.Qt.QCoreApplication"), | ||
179 | QStringLiteral("quit")); | 180 | QStringLiteral("quit")); | ||
180 | QDBusConnection::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits | 181 | QDBusConnection::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits | ||
181 | } | 182 | } | ||
182 | } | 183 | } | ||
183 | 184 | | |||
184 | KDBusService service(KDBusService::Unique); | 185 | KDBusService service(KDBusService::Unique); | ||
185 | 186 | | |||
186 | | ||||
187 | QObject::connect(ShellManager::instance(), &ShellManager::glInitialisationFailed, &app, [&app]() { | 187 | QObject::connect(ShellManager::instance(), &ShellManager::glInitialisationFailed, &app, [&app]() { | ||
188 | //scene graphs errors come from a thread | 188 | //scene graphs errors come from a thread | ||
189 | //even though we process them in the main thread, app.exit could still process these events | 189 | //even though we process them in the main thread, app.exit could still process these events | ||
190 | static bool s_multipleInvokations = false; | 190 | static bool s_multipleInvokations = false; | ||
191 | if (s_multipleInvokations) { | 191 | if (s_multipleInvokations) { | ||
192 | return; | 192 | return; | ||
193 | } | 193 | } | ||
194 | s_multipleInvokations = true; | 194 | s_multipleInvokations = true; | ||
195 | 195 | | |||
196 | qCritical("Open GL context could not be created"); | 196 | qCritical("Open GL context could not be created"); | ||
197 | auto configGroup = KSharedConfig::openConfig()->group("QtQuickRendererSettings"); | 197 | auto configGroup = KSharedConfig::openConfig()->group("QtQuickRendererSettings"); | ||
198 | if (configGroup.readEntry("SceneGraphBackend") != QLatin1String("software")) { | 198 | if (configGroup.readEntry("SceneGraphBackend") != QLatin1String("software")) { | ||
199 | configGroup.writeEntry("SceneGraphBackend", "software", KConfigBase::Global | KConfigBase::Persistent); | 199 | configGroup.writeEntry("SceneGraphBackend", "software", KConfigBase::Global | KConfigBase::Persistent); | ||
200 | configGroup.sync(); | 200 | configGroup.sync(); | ||
201 | QProcess::startDetached("plasmashell", app.arguments()); | 201 | QProcess::startDetached("plasmashell", app.arguments()); | ||
202 | } else { | 202 | } else { | ||
203 | QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets); | 203 | QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets); | ||
204 | QMessageBox::critical(nullptr, i18n("Plasma Failed To Start"), | 204 | QMessageBox::critical(nullptr, i18n("Plasma Failed To Start"), | ||
205 | i18n("Plasma is unable to start as it could not correctly use OpenGL 2 or software fallback\nPlease check that your graphic drivers are set up correctly.")); | 205 | i18n("Plasma is unable to start as it could not correctly use OpenGL 2 or software fallback\nPlease check that your graphic drivers are set up correctly.")); | ||
206 | } | 206 | } | ||
207 | app.exit(-1); | 207 | app.exit(-1); | ||
208 | }); | 208 | }); | ||
209 | SoftwareRendererNotifier::notifyIfRelevant(); | ||||
209 | QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, ShellManager::instance(), &QObject::deleteLater); | 210 | QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, ShellManager::instance(), &QObject::deleteLater); | ||
210 | 211 | | |||
211 | return app.exec(); | 212 | return app.exec(); | ||
212 | } | 213 | } |