Revert "Move kcminit_startup and kded to plasma-session"

This reverts commit 930e991b.

It completely breaks Plasma startup, as found by openQA.

CCMAIL: aleixpol@kde.org
CCMAIL: david@davidedmundson.co.uk
parent 930e991b
......@@ -203,35 +203,34 @@ Startup::Startup(QObject *parent):
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Startup"), QStringLiteral("org.kde.Startup"), this);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.Startup"));
upAndRunning(QStringLiteral("ksmserver"));
const AutoStart autostart;
KJob* phase1;
const QVector<KJob*> sequence = {
new StartProcessJob(QStringLiteral("kcminit_startup"), {}),
new StartServiceJob(QStringLiteral("kded5"), {}, QStringLiteral("org.kde.kded"), QProcess::systemEnvironment() << QStringList{ QStringLiteral("KDED_STARTED_BY_KDEINIT=1") }),
new StartServiceJob(QStringLiteral("ksmserver"), QCoreApplication::instance()->arguments().mid(1), QStringLiteral("org.kde.ksmserver")),
new StartupPhase0(autostart, this),
phase1 = new StartupPhase1(autostart, this),
new RestoreSessionJob(),
new StartupPhase2(autostart, this),
};
KJob* last = nullptr;
for(KJob* job : sequence) {
if (last) {
connect(last, &KJob::finished, job, &KJob::start);
}
last = job;
}
auto phase0 = new StartupPhase0(autostart, this);
auto phase1 = new StartupPhase1(autostart, this);
auto phase2 = new StartupPhase2(autostart, this);
auto restoreSession = new RestoreSessionJob();
// this includes starting kwin (currently)
// forward our arguments into ksmserver to match startplasma expectations
QStringList arguments = qApp->arguments();
arguments.removeFirst();
auto ksmserverJob = new StartServiceJob(QStringLiteral("ksmserver"), arguments, QStringLiteral("org.kde.ksmserver"));
connect(ksmserverJob, &KJob::finished, phase0, &KJob::start);
connect(phase0, &KJob::finished, phase1, &KJob::start);
connect(phase1, &KJob::finished, restoreSession, &KJob::start);
connect(restoreSession, &KJob::finished, phase2, &KJob::start);
upAndRunning(QStringLiteral("ksmserver"));
connect(phase1, &KJob::finished, this, []() {
NotificationThread *loginSound = new NotificationThread();
connect(loginSound, &NotificationThread::finished, loginSound, &NotificationThread::deleteLater);
loginSound->start();
});
loginSound->start();});
connect(phase2, &KJob::finished, this, &Startup::finishStartup);
connect(sequence.last(), &KJob::finished, this, &Startup::finishStartup);
sequence.first()->start();
ksmserverJob->start();
}
void Startup::upAndRunning( const QString& msg )
......@@ -409,11 +408,10 @@ void AutoStartAppsJob::start() {
}
StartServiceJob::StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId, const QStringList &env):
StartServiceJob::StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId):
KJob(),
m_process(process),
m_args(args),
m_env(env)
m_args(args)
{
auto watcher = new QDBusServiceWatcher(serviceId, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &StartServiceJob::emitResult);
......@@ -421,34 +419,8 @@ StartServiceJob::StartServiceJob(const QString &process, const QStringList &args
void StartServiceJob::start()
{
QProcess* p = new QProcess(this);
p->setEnvironment(m_env);
if (!p->startDetached(m_process, m_args))
qCWarning(PLASMA_SESSION) << "error starting process" << m_process << m_args;
connect(p, &QProcess::errorOccurred, this, [this] (QProcess::ProcessError error) {
qCWarning(PLASMA_SESSION) << "error on process" << error << m_process << m_args;
});
QProcess::startDetached(m_process, m_args);
}
StartProcessJob::StartProcessJob(const QString &process, const QStringList &args, const QStringList &env)
: KJob()
, m_process(new QProcess(this))
{
m_process->setProgram(process);
m_process->setArguments(args);
m_process->setEnvironment(env);
connect(m_process, &QProcess::errorOccurred, this, [process, args] (QProcess::ProcessError error) {
qCWarning(PLASMA_SESSION) << "error starting process" << error << process << args;
});
connect(m_process, &QProcess::started, this, &StartProcessJob::emitResult);
}
void StartProcessJob::start()
{
if (!m_process->startDetached())
qCWarning(PLASMA_SESSION) << "error starting process" << m_process->program();
}
#include "startup.moc"
......@@ -29,8 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "autostart.h"
class QProcess;
class Startup : public QObject
{
Q_OBJECT
......@@ -80,19 +78,6 @@ private:
AutoStart m_autoStart;
};
/**
* Launches a process, and waits for the process to start
*/
class StartProcessJob: public KJob
{
Q_OBJECT
public:
StartProcessJob(const QString &process, const QStringList &args, const QStringList &env = {});
void start() override;
private:
QProcess* m_process;
};
/**
* Launches a process, and waits for the service to appear on the session bus
*/
......@@ -100,12 +85,11 @@ class StartServiceJob: public KJob
{
Q_OBJECT
public:
StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId, const QStringList &env = {});
StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId);
void start() override;
private:
const QString m_process;
const QStringList m_args;
const QStringList m_env;
};
class RestoreSessionJob: public KJob
......
......@@ -56,6 +56,9 @@ int main(int /*argc*/, char** /*argv*/)
return 2;
}
if (!startKDEInit())
return 3;
if (!startKSMServer(true))
return 4;
......
......@@ -99,6 +99,9 @@ int main(int /*argc*/, char** /*argv*/)
return 1;
}
if (!startKDEInit())
return 1;
if (!startKSMServer(false))
return 1;
......
......@@ -327,10 +327,23 @@ void setupGSLib()
}
}
bool startKSMServer(bool wayland)
bool startKDEInit()
{
// We set LD_BIND_NOW to increase the efficiency of kdeinit.
// kdeinit unsets this variable before loading applications.
const int exitCode = runSync(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/start_kdeinit_wrapper"), { QStringLiteral("--kded"), QStringLiteral("+kcminit_startup") }, { QStringLiteral("LD_BIND_NOW=true") });
if (exitCode != 0) {
messageBox(QStringLiteral("startkde: Could not start kdeinit5. Check your installation."));
return false;
}
OrgKdeKSplashInterface iface(QStringLiteral("org.kde.KSplash"), QStringLiteral("/KSplash"), QDBusConnection::sessionBus());
iface.setStage(QStringLiteral("kinit"));
return true;
}
bool startKSMServer(bool wayland)
{
// finally, give the session control to the session manager
// see kdebase/ksmserver for the description of the rest of the startup sequence
// if the KDEWM environment variable has been set, then it will be used as KDE's
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment