Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/main.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
43 | #include <ksmserver_debug.h> | 43 | #include <ksmserver_debug.h> | ||
44 | #include "server.h" | 44 | #include "server.h" | ||
45 | #include <QX11Info> | 45 | #include <QX11Info> | ||
46 | 46 | | |||
47 | #include <QApplication> | 47 | #include <QApplication> | ||
48 | #include <QQuickWindow> | 48 | #include <QQuickWindow> | ||
49 | #include <X11/extensions/Xrender.h> | 49 | #include <X11/extensions/Xrender.h> | ||
50 | 50 | | |||
51 | #include <config.h> | ||||
52 | #include "policykit-agent/policykitkde.h" | ||||
53 | | ||||
54 | #if HAVE_SYS_PRCTL_H | ||||
55 | #include <sys/prctl.h> | ||||
56 | #endif | ||||
57 | #if HAVE_SYS_PROCCTL_H | ||||
58 | #include <unistd.h> | ||||
59 | #include <sys/procctl.h> | ||||
60 | #endif | ||||
61 | | ||||
51 | static const char version[] = "0.4"; | 62 | static const char version[] = "0.4"; | ||
52 | static const char description[] = I18N_NOOP( "The reliable KDE session manager that talks the standard X11R6 \nsession management protocol (XSMP)." ); | 63 | static const char description[] = I18N_NOOP( "The reliable KDE session manager that talks the standard X11R6 \nsession management protocol (XSMP)." ); | ||
53 | 64 | | |||
54 | Display* dpy = 0; | 65 | Display* dpy = 0; | ||
55 | Colormap colormap = 0; | 66 | Colormap colormap = 0; | ||
56 | Visual *visual = 0; | 67 | Visual *visual = 0; | ||
57 | 68 | | |||
58 | extern KSMServer* the_server; | 69 | extern KSMServer* the_server; | ||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 224 | { | |||
225 | KMessageBox::error(0, qmsg, i18n("Plasma Workspace installation problem!")); | 236 | KMessageBox::error(0, qmsg, i18n("Plasma Workspace installation problem!")); | ||
226 | exit(255); | 237 | exit(255); | ||
227 | } | 238 | } | ||
228 | } | 239 | } | ||
229 | 240 | | |||
230 | extern "C" Q_DECL_EXPORT int kdemain( int argc, char* argv[] ) | 241 | extern "C" Q_DECL_EXPORT int kdemain( int argc, char* argv[] ) | ||
231 | { | 242 | { | ||
232 | sanity_check(argc, argv); | 243 | sanity_check(argc, argv); | ||
244 | // disable ptrace as we are the polkit agent | ||||
245 | #if HAVE_PR_SET_DUMPABLE | ||||
246 | prctl(PR_SET_DUMPABLE, 0); | ||||
247 | #endif | ||||
248 | #if HAVE_PROC_TRACE_CTL | ||||
249 | int mode = PROC_TRACE_CTL_DISABLE; | ||||
250 | procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode); | ||||
251 | #endif | ||||
252 | | ||||
253 | | ||||
233 | 254 | | |||
234 | putenv((char*)"SESSION_MANAGER="); | 255 | putenv((char*)"SESSION_MANAGER="); | ||
235 | checkComposite(); | 256 | checkComposite(); | ||
236 | 257 | | |||
237 | // force xcb QPA plugin as ksmserver is very X11 specific | 258 | // force xcb QPA plugin as ksmserver is very X11 specific | ||
238 | const QByteArray origQpaPlatform = qgetenv("QT_QPA_PLATFORM"); | 259 | const QByteArray origQpaPlatform = qgetenv("QT_QPA_PLATFORM"); | ||
239 | qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb")); | 260 | qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb")); | ||
240 | 261 | | |||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 330 | #endif | |||
342 | else if ( loginMode == QStringLiteral( "restorePreviousLogout" ) ) | 363 | else if ( loginMode == QStringLiteral( "restorePreviousLogout" ) ) | ||
343 | server->restoreSession( QStringLiteral( SESSION_PREVIOUS_LOGOUT ) ); | 364 | server->restoreSession( QStringLiteral( SESSION_PREVIOUS_LOGOUT ) ); | ||
344 | else if ( loginMode == QStringLiteral( "restoreSavedSession" ) ) | 365 | else if ( loginMode == QStringLiteral( "restoreSavedSession" ) ) | ||
345 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | 366 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | ||
346 | else | 367 | else | ||
347 | server->startDefaultSession(); | 368 | server->startDefaultSession(); | ||
348 | 369 | | |||
349 | KDBusService service(KDBusService::Unique); | 370 | KDBusService service(KDBusService::Unique); | ||
371 | //we are also the polkit agent, KAuth contains a special call to the polkit agent for wID sharing, keep the same service name | ||||
372 | QDBusConnection::sessionBus().registerService("org.kde.polkit-kde-authentication-agent-1"); | ||||
373 | PolicyKitKDE::registerAgent(a); | ||||
350 | 374 | | |||
351 | int ret = a->exec(); | 375 | int ret = a->exec(); | ||
352 | kde_running.release(); // needs to be done before QApplication destruction | 376 | kde_running.release(); // needs to be done before QApplication destruction | ||
353 | delete a; | 377 | delete a; | ||
354 | return ret; | 378 | return ret; | ||
355 | } | 379 | } |