Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/server.cpp
Show First 20 Lines • Show All 620 Lines • ▼ Show 20 Line(s) | 603 | { | |||
---|---|---|---|---|---|
621 | 621 | | |||
622 | state = Idle; | 622 | state = Idle; | ||
623 | saveSession = false; | 623 | saveSession = false; | ||
624 | wmPhase1WaitingCount = 0; | 624 | wmPhase1WaitingCount = 0; | ||
625 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | 625 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | ||
626 | clientInteracting = nullptr; | 626 | clientInteracting = nullptr; | ||
627 | xonCommand = config.readEntry( "xonCommand", "xon" ); | 627 | xonCommand = config.readEntry( "xonCommand", "xon" ); | ||
628 | 628 | | |||
629 | selectWm( windowManager ); | 629 | if (windowManager.isEmpty()) { | ||
630 | wm = QStringLiteral(KWIN_BIN); | ||||
631 | } else { | ||||
632 | wm = windowManager; | ||||
633 | } | ||||
634 | wmCommands = QStringList({wm}); | ||||
630 | 635 | | |||
631 | only_local = flags.testFlag(InitFlag::OnlyLocal); | 636 | only_local = flags.testFlag(InitFlag::OnlyLocal); | ||
632 | #ifdef HAVE__ICETRANSNOLISTEN | 637 | #ifdef HAVE__ICETRANSNOLISTEN | ||
633 | if (only_local) | 638 | if (only_local) | ||
634 | _IceTransNoListen("tcp"); | 639 | _IceTransNoListen("tcp"); | ||
635 | #else | 640 | #else | ||
636 | only_local = false; | 641 | only_local = false; | ||
637 | #endif | 642 | #endif | ||
▲ Show 20 Lines • Show All 340 Lines • ▼ Show 20 Line(s) | 979 | { | |||
978 | return programName == wmName; | 983 | return programName == wmName; | ||
979 | } | 984 | } | ||
980 | 985 | | |||
981 | bool KSMServer::defaultSession() const | 986 | bool KSMServer::defaultSession() const | ||
982 | { | 987 | { | ||
983 | return sessionGroup.isEmpty(); | 988 | return sessionGroup.isEmpty(); | ||
984 | } | 989 | } | ||
985 | 990 | | |||
986 | // selection logic: | | |||
987 | // - $KDEWM is set - use that | | |||
988 | // - a wm is selected using the kcm - use that | | |||
989 | // - if that fails, just use KWin | | |||
990 | void KSMServer::selectWm( const QString& kdewm ) | | |||
991 | { | | |||
992 | wm = QStringLiteral( KWIN_BIN ); // defaults | | |||
993 | wmCommands = ( QStringList() << QStringLiteral( KWIN_BIN ) ); | | |||
994 | if( !kdewm.isEmpty()) | | |||
995 | { | | |||
996 | wmCommands = ( QStringList() << kdewm ); | | |||
997 | wm = kdewm; | | |||
998 | return; | | |||
999 | } | | |||
1000 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | | |||
1001 | | ||||
1002 | QString cfgwm = config.readEntry( "windowManager", "kwin" ); | | |||
1003 | KDesktopFile file( QStandardPaths::AppDataLocation, | | |||
1004 | QStringLiteral( "windowmanagers/" ) + cfgwm + QStringLiteral( ".desktop" ) ); | | |||
1005 | | ||||
1006 | if( file.noDisplay()) | | |||
1007 | return; | | |||
1008 | if( !file.tryExec()) | | |||
1009 | return; | | |||
1010 | QString testexec = file.desktopGroup().readEntry( "X-KDE-WindowManagerTestExec" ); | | |||
1011 | if( !testexec.isEmpty()) | | |||
1012 | { | | |||
1013 | KProcess proc; | | |||
1014 | proc.setShellCommand( testexec ); | | |||
1015 | if( proc.execute() != 0 ) | | |||
1016 | return; | | |||
1017 | } | | |||
1018 | QStringList cfgWmCommands = KShell::splitArgs( file.desktopGroup().readEntry( "Exec" )); | | |||
1019 | if( cfgWmCommands.isEmpty()) | | |||
1020 | return; | | |||
1021 | QString smname = file.desktopGroup().readEntry( "X-KDE-WindowManagerId" ); | | |||
1022 | // ok | | |||
1023 | wm = smname.isEmpty() ? cfgwm : smname; | | |||
1024 | wmCommands = cfgWmCommands; | | |||
1025 | } | | |||
1026 | | ||||
1027 | void KSMServer::wmChanged() | | |||
1028 | { | | |||
1029 | KSharedConfig::openConfig()->reparseConfiguration(); | | |||
1030 | selectWm( QStringLiteral( "" ) ); | | |||
1031 | } | | |||
1032 | | ||||
1033 | void KSMServer::setupShortcuts() | 991 | void KSMServer::setupShortcuts() | ||
1034 | { | 992 | { | ||
1035 | if (KAuthorized::authorize( QStringLiteral( "logout" ))) { | 993 | if (KAuthorized::authorize( QStringLiteral( "logout" ))) { | ||
1036 | KActionCollection* actionCollection = new KActionCollection(this); | 994 | KActionCollection* actionCollection = new KActionCollection(this); | ||
1037 | QAction* a; | 995 | QAction* a; | ||
1038 | a = actionCollection->addAction(QStringLiteral("Log Out")); | 996 | a = actionCollection->addAction(QStringLiteral("Log Out")); | ||
1039 | a->setText(i18n("Log Out")); | 997 | a->setText(i18n("Log Out")); | ||
1040 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::ALT+Qt::CTRL+Qt::Key_Delete); | 998 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::ALT+Qt::CTRL+Qt::Key_Delete); | ||
▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines |