Remove dead code in helpers

This commit is contained in:
Fabian Vogt 2023-02-05 19:16:27 +01:00 committed by davidedmundson
parent eaf7c51ddc
commit a0066e4d17
4 changed files with 4 additions and 39 deletions

View File

@ -39,16 +39,6 @@ WaylandHelper::WaylandHelper(QObject *parent)
{
}
QProcessEnvironment WaylandHelper::environment() const
{
return m_environment;
}
void WaylandHelper::setEnvironment(const QProcessEnvironment &env)
{
m_environment = env;
}
bool WaylandHelper::startCompositor(const QString &cmd)
{
m_watcher->start();

View File

@ -31,9 +31,6 @@ class WaylandHelper : public QObject
public:
explicit WaylandHelper(QObject *parent = nullptr);
QProcessEnvironment environment() const;
void setEnvironment(const QProcessEnvironment &env);
bool startCompositor(const QString &cmd);
void startGreeter(const QString &cmd);
void stop();

View File

@ -32,43 +32,27 @@ namespace SDDM {
XOrgUserHelper::XOrgUserHelper(QObject *parent)
: QObject(parent)
, m_environment(QProcessEnvironment::systemEnvironment())
{
}
QProcessEnvironment XOrgUserHelper::sessionEnvironment() const
{
auto env = m_environment;
auto env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("DISPLAY"), m_display);
env.insert(QStringLiteral("XAUTHORITY"), m_xauth.authPath());
env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("xcb"));
return env;
}
QProcessEnvironment XOrgUserHelper::environment() const
{
return m_environment;
}
void XOrgUserHelper::setEnvironment(const QProcessEnvironment &env)
{
m_environment = env;
}
QString XOrgUserHelper::display() const
{
return m_display;
}
QString XOrgUserHelper::xauthPath() const
{
return m_xauth.authPath();
}
bool XOrgUserHelper::start(const QString &cmd)
{
// Create xauthority
m_xauth.setAuthDirectory(m_environment.value(QStringLiteral("XDG_RUNTIME_DIR")));
m_xauth.setAuthDirectory(qEnvironmentVariable("XDG_RUNTIME_DIR"));
m_xauth.setup();
// Start server process
@ -155,7 +139,7 @@ bool XOrgUserHelper::startServer(const QString &cmd)
// under Fedora and all distros that use their patch.
// https://src.fedoraproject.org/rpms/xorg-x11-server/blob/rawhide/f/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
// https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights
QProcessEnvironment serverEnv = m_environment;
auto serverEnv = QProcessEnvironment::systemEnvironment();
serverEnv.insert(QStringLiteral("XORG_RUN_AS_USER_OK"), QStringLiteral("1"));
// Append xauth and display fd to the command

View File

@ -33,16 +33,11 @@ class XOrgUserHelper : public QObject
public:
explicit XOrgUserHelper(QObject *parent = nullptr);
QProcessEnvironment environment() const;
void setEnvironment(const QProcessEnvironment &env);
/// @returns the same as @m environment plus the variables we need here
/// @returns the system environment plus the variables we need here
QProcessEnvironment sessionEnvironment() const;
QString display() const;
QString xauthPath() const;
bool start(const QString &cmd);
void stop();
@ -52,7 +47,6 @@ Q_SIGNALS:
private:
QString m_display = QStringLiteral(":0");
XAuth m_xauth;
QProcessEnvironment m_environment;
QProcess *m_serverProcess = nullptr;
bool startProcess(const QString &cmd, const QProcessEnvironment &env,