Skip to content

Commit

Permalink
WIP Xorg user session
Browse files Browse the repository at this point in the history
We want to support Xorg user session and keep running it as root as an
option, so we don't break the workflow of some users.

As a matter of fact, when we run the X11 server as sddm user, we also
start the display start and stop scripts as user.  Scripts that need
root privileges won't work.

To support both modes, we move the code to sddm-x11-helper and either
run it as root or sddm user using sddm-helper.

Closes: sddm#246
  • Loading branch information
plfiorini authored and aleixpol committed Feb 17, 2021
1 parent 3c0a38a commit b76b00f
Show file tree
Hide file tree
Showing 11 changed files with 773 additions and 139 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -3,3 +3,4 @@ configure_file("common/Constants.h.in" "common/Constants.h" IMMEDIATE @ONLY)
add_subdirectory(daemon)
add_subdirectory(greeter)
add_subdirectory(helper)
add_subdirectory(x11helper)
2 changes: 2 additions & 0 deletions src/common/Configuration.h
Expand Up @@ -43,6 +43,8 @@ namespace SDDM {
"If property is set to none, numlock won't be changed\n"
"NOTE: Currently ignored if autologin is enabled."));
Entry(InputMethod, QString, QStringLiteral("qtvirtualkeyboard"), _S("Input method module"));
Entry(DisplayServer, QString, _S("x11"), _S("Which display server should be used.\n"
"Valid values are: x11, x11-user."));
Entry(Namespaces, QStringList, QStringList(), _S("Comma-separated list of Linux namespaces for user session to enter"));
Entry(DisplayServer, QString, _S("x11"), _S("Which display server should be used.\n"
"NOTE: Wayland support is currently considered experimental.\n"
Expand Down
53 changes: 53 additions & 0 deletions src/common/x11helperprotocol.h
@@ -0,0 +1,53 @@
/***************************************************************************
* Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
***************************************************************************/

#ifndef SDDM_X11HELPERPROTOCOL_H
#define SDDM_X11HELPERPROTOCOL_H

#include <QDataStream>

namespace SDDM {

enum class X11HelperMessage {
Unknown,
Started,
Last
};

inline QDataStream &operator>>(QDataStream &s, X11HelperMessage &m)
{
qint32 what;
s >> what;
if (what < qint32(X11HelperMessage::Unknown) || what >= qint32(X11HelperMessage::Last)) {
s.setStatus(QDataStream::ReadCorruptData);
return s;
}
m = X11HelperMessage(what);
return s;
}

inline QDataStream &operator<<(QDataStream &s, const X11HelperMessage &m)
{
s << qint32(m);
return s;
}

} // namespace SDDM

#endif // SDDM_X11HELPERPROTOCOL_H
3 changes: 0 additions & 3 deletions src/daemon/Display.cpp
Expand Up @@ -147,9 +147,6 @@ namespace SDDM {
if (m_started)
return;

// setup display
m_displayServer->setupDisplay();

// log message
qDebug() << "Display server started.";

Expand Down
1 change: 0 additions & 1 deletion src/daemon/DisplayServer.h
Expand Up @@ -44,7 +44,6 @@ namespace SDDM {
virtual bool start() = 0;
virtual void stop() = 0;
virtual void finished() = 0;
virtual void setupDisplay() = 0;

signals:
void started();
Expand Down

0 comments on commit b76b00f

Please sign in to comment.