Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ddm (0.1.8) unstable; urgency=medium

* limit treeland restart to 3

-- Dingyuan Zhang <[email protected]> Fri, 13 Dec 2024 10:44:00 +0800

ddm (0.1.7) unstable; urgency=medium

* fix black screen when user activate session
Expand Down
10 changes: 10 additions & 0 deletions src/daemon/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ namespace DDM {
stop();
});
connect(m_greeter, &Greeter::displayServerFailed, this, &Display::displayServerFailed);
connect(m_greeter, &Greeter::greeterStarted, this, [this] {
if (m_currentAuth) {
switchToUser(m_currentAuth->user());
}
});
}

Display::~Display() {
Expand Down Expand Up @@ -588,6 +593,7 @@ namespace DDM {

Q_ASSERT(auth && auth->identifyOnly() == identifyOnly);

m_currentAuth = auth;
m_greeter->setUserActivated(success);

if (success) {
Expand Down Expand Up @@ -663,6 +669,10 @@ namespace DDM {
// error happens (in this case we want to show the message from the
// greeter

if (m_currentAuth == auth) {
m_currentAuth = nullptr;
}

m_auths.removeOne(auth);
auth->deleteLater();

Expand Down
1 change: 1 addition & 0 deletions src/daemon/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ namespace DDM {
QString m_reuseSessionId;

QVector<Auth*> m_auths;
Auth* m_currentAuth { nullptr };
DisplayServer *m_displayServer { nullptr };
Seat *m_seat { nullptr };
SocketServer *m_socketServer { nullptr };
Expand Down
18 changes: 17 additions & 1 deletion src/daemon/Greeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "WaylandDisplayServer.h"
#include "PowerManager.h"

#include <QTimer>
#include <QtCore/QDebug>
#include <QtCore/QProcess>
#include <VirtualTerminal.h>
Expand All @@ -40,9 +41,15 @@ namespace DDM {
Greeter::Greeter(Display *parent)
: QObject(parent)
, m_display(parent)
, m_tryTimer(new QTimer(this))
{
m_metadata = new ThemeMetadata(QString());
m_themeConfig = new ThemeConfig(QString());

connect(m_tryTimer, &QTimer::timeout, this, &Greeter::greeterStarted);

m_tryTimer->setSingleShot(true);
m_tryTimer->setInterval(500);
}

Greeter::~Greeter() {
Expand Down Expand Up @@ -243,6 +250,8 @@ namespace DDM {
m_auth->setSession(cmd.join(QLatin1Char(' ')));
m_auth->setSingleMode(m_singleMode);
m_auth->start();

m_tryTimer->start();
}

// return success
Expand Down Expand Up @@ -322,14 +331,21 @@ namespace DDM {
}

void Greeter::onHelperFinished(Auth::HelperExitStatus status) {
if (m_singleMode) {
if (m_singleMode && m_currentRetry <= m_maxRetry) {
m_currentRetry += 1;
qDebug() << "Restart treeland";
QString displayServerCmd = m_displayServerCmd;
if (!m_userActivated) {
displayServerCmd += " --lockscreen";
}
m_auth->setDisplayServerCommand(displayServerCmd);
m_auth->start();

if (m_tryTimer->isActive()) {
m_tryTimer->stop();
}

m_tryTimer->start();
return;
}

Expand Down
4 changes: 4 additions & 0 deletions src/daemon/Greeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Auth.h"

class QProcess;
class QTimer;

namespace DDM {
class Display;
Expand Down Expand Up @@ -66,11 +67,13 @@ namespace DDM {
void ttyFailed();
void failed();
void displayServerFailed();
void greeterStarted();

private:
bool m_started { false };
bool m_singleMode { false };
bool m_userActivated { false };
int m_currentRetry { 0 };
int m_maxRetry{ 3 };

Display * const m_display { nullptr };
Expand All @@ -82,6 +85,7 @@ namespace DDM {

Auth *m_auth { nullptr };
QProcess *m_process { nullptr };
QTimer *m_tryTimer { nullptr };

static void insertEnvironmentList(QStringList names, QProcessEnvironment sourceEnv, QProcessEnvironment &targetEnv);
};
Expand Down
Loading