Skip to content
Merged
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
28 changes: 28 additions & 0 deletions src/dde-session/impl/sessionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ void SessionManager::RequestHibernate()

void SessionManager::RequestLock()
{
if (Utils::IS_WAYLAND_DISPLAY) {
// On Wayland the lock screen is owned by treeland and driven via logind.
// The X11-only LockFront1 (dde-lock) has no provider here, so calling it
// would hang on a 120s D-Bus activation timeout. Ask logind to lock.
qDebug() << "RequestLock on wayland: ask logind to lock";
m_login1SessionInter->Lock();
m_inCallRequestLock = false;
return;
}

QDBusInterface inter("org.deepin.dde.LockFront1", "/org/deepin/dde/LockFront1", "org.deepin.dde.LockFront1", QDBusConnection::sessionBus());

// 使用异步调用方式防止当前线程阻塞
Expand Down Expand Up @@ -1025,6 +1035,15 @@ void SessionManager::handleLoginSessionLocked()
return;
}

if (Utils::IS_WAYLAND_DISPLAY) {
// On Wayland treeland shows the lock screen on this same logind Lock
// signal; only sync local state here (calling RequestLock would loop).
qDebug() << "handleLoginSessionLocked on wayland: sync local state";
m_locked = true;
emitLockChanged(true);
return;
}

// 防止短时间内多次同时调用 RequestLock
if (m_inCallRequestLock) {
qDebug() << "handleLoginSessionLocked inCall is true, return";
Expand All @@ -1041,6 +1060,15 @@ void SessionManager::handleLoginSessionUnlocked()
{
qDebug() << "login session unlocked.";

if (Utils::IS_WAYLAND_DISPLAY) {
// On Wayland there is no X11 LockFront1 process to kill; only sync state.
qDebug() << "handleLoginSessionUnlocked on wayland: sync local state";
m_locked = false;
emitLockChanged(false);
Q_EMIT Unlock();
return;
}

bool sessionActive = m_login1SessionInter->active();
if (sessionActive) {
Q_EMIT Unlock();
Expand Down
Loading