mirror of
https://github.com/sddm/sddm.git
synced 2024-11-23 18:13:26 +08:00
Remove dead code in helpers
This commit is contained in:
parent
eaf7c51ddc
commit
a0066e4d17
@ -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)
|
bool WaylandHelper::startCompositor(const QString &cmd)
|
||||||
{
|
{
|
||||||
m_watcher->start();
|
m_watcher->start();
|
||||||
|
@ -31,9 +31,6 @@ class WaylandHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit WaylandHelper(QObject *parent = nullptr);
|
explicit WaylandHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
QProcessEnvironment environment() const;
|
|
||||||
void setEnvironment(const QProcessEnvironment &env);
|
|
||||||
|
|
||||||
bool startCompositor(const QString &cmd);
|
bool startCompositor(const QString &cmd);
|
||||||
void startGreeter(const QString &cmd);
|
void startGreeter(const QString &cmd);
|
||||||
void stop();
|
void stop();
|
||||||
|
@ -32,43 +32,27 @@ namespace SDDM {
|
|||||||
|
|
||||||
XOrgUserHelper::XOrgUserHelper(QObject *parent)
|
XOrgUserHelper::XOrgUserHelper(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_environment(QProcessEnvironment::systemEnvironment())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcessEnvironment XOrgUserHelper::sessionEnvironment() const
|
QProcessEnvironment XOrgUserHelper::sessionEnvironment() const
|
||||||
{
|
{
|
||||||
auto env = m_environment;
|
auto env = QProcessEnvironment::systemEnvironment();
|
||||||
env.insert(QStringLiteral("DISPLAY"), m_display);
|
env.insert(QStringLiteral("DISPLAY"), m_display);
|
||||||
env.insert(QStringLiteral("XAUTHORITY"), m_xauth.authPath());
|
env.insert(QStringLiteral("XAUTHORITY"), m_xauth.authPath());
|
||||||
env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("xcb"));
|
env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("xcb"));
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcessEnvironment XOrgUserHelper::environment() const
|
|
||||||
{
|
|
||||||
return m_environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XOrgUserHelper::setEnvironment(const QProcessEnvironment &env)
|
|
||||||
{
|
|
||||||
m_environment = env;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString XOrgUserHelper::display() const
|
QString XOrgUserHelper::display() const
|
||||||
{
|
{
|
||||||
return m_display;
|
return m_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString XOrgUserHelper::xauthPath() const
|
|
||||||
{
|
|
||||||
return m_xauth.authPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XOrgUserHelper::start(const QString &cmd)
|
bool XOrgUserHelper::start(const QString &cmd)
|
||||||
{
|
{
|
||||||
// Create xauthority
|
// Create xauthority
|
||||||
m_xauth.setAuthDirectory(m_environment.value(QStringLiteral("XDG_RUNTIME_DIR")));
|
m_xauth.setAuthDirectory(qEnvironmentVariable("XDG_RUNTIME_DIR"));
|
||||||
m_xauth.setup();
|
m_xauth.setup();
|
||||||
|
|
||||||
// Start server process
|
// Start server process
|
||||||
@ -155,7 +139,7 @@ bool XOrgUserHelper::startServer(const QString &cmd)
|
|||||||
// under Fedora and all distros that use their patch.
|
// 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://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
|
// https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights
|
||||||
QProcessEnvironment serverEnv = m_environment;
|
auto serverEnv = QProcessEnvironment::systemEnvironment();
|
||||||
serverEnv.insert(QStringLiteral("XORG_RUN_AS_USER_OK"), QStringLiteral("1"));
|
serverEnv.insert(QStringLiteral("XORG_RUN_AS_USER_OK"), QStringLiteral("1"));
|
||||||
|
|
||||||
// Append xauth and display fd to the command
|
// Append xauth and display fd to the command
|
||||||
|
@ -33,16 +33,11 @@ class XOrgUserHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit XOrgUserHelper(QObject *parent = nullptr);
|
explicit XOrgUserHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
QProcessEnvironment environment() const;
|
/// @returns the system environment plus the variables we need here
|
||||||
void setEnvironment(const QProcessEnvironment &env);
|
|
||||||
|
|
||||||
/// @returns the same as @m environment plus the variables we need here
|
|
||||||
QProcessEnvironment sessionEnvironment() const;
|
QProcessEnvironment sessionEnvironment() const;
|
||||||
|
|
||||||
QString display() const;
|
QString display() const;
|
||||||
|
|
||||||
QString xauthPath() const;
|
|
||||||
|
|
||||||
bool start(const QString &cmd);
|
bool start(const QString &cmd);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
@ -52,7 +47,6 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
QString m_display = QStringLiteral(":0");
|
QString m_display = QStringLiteral(":0");
|
||||||
XAuth m_xauth;
|
XAuth m_xauth;
|
||||||
QProcessEnvironment m_environment;
|
|
||||||
QProcess *m_serverProcess = nullptr;
|
QProcess *m_serverProcess = nullptr;
|
||||||
|
|
||||||
bool startProcess(const QString &cmd, const QProcessEnvironment &env,
|
bool startProcess(const QString &cmd, const QProcessEnvironment &env,
|
||||||
|
Loading…
Reference in New Issue
Block a user