Skip to content

fix: lockscreen not shown after switch back from tty#761

Open
calsys456 wants to merge 1 commit intolinuxdeepin:masterfrom
calsys456:master
Open

fix: lockscreen not shown after switch back from tty#761
calsys456 wants to merge 1 commit intolinuxdeepin:masterfrom
calsys456:master

Conversation

@calsys456
Copy link
Copy Markdown
Collaborator

The LockView.qml (in fact the whole lockscreen component in Greeter.qml) is re-created after switch back from tty, as the output is exactly being removed and re-added once. So that we cannot use property listener for displaying lockscreen as usual.

This will work as intended.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @calsys456, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes cases where the lockscreen UI is re-created after switching back from a TTY, so the lockscreen should still appear correctly even if the usual property-change signal isn’t re-emitted.
中文:修复从 TTY 切回后锁屏 UI 被重建的场景,确保即使没有再次触发属性变更信号,锁屏也能正确显示。

Changes:

  • Adds a GreeterProxy::isLocked() guard before invoking m_lockScreen->lock() in Helper::showLockScreen().
    中文:在 Helper::showLockScreen() 中调用 m_lockScreen->lock() 前新增 GreeterProxy::isLocked() 判断。
  • Refactors LockView.qml to route GreeterProxy.lockChanged into a local onLockChanged() function and triggers it from Component.onCompleted.
    中文:重构 LockView.qml,将 GreeterProxy.lockChanged 的处理提取到本地 onLockChanged(),并在 Component.onCompleted 时触发。
  • Adds a C++-only setter GreeterProxy::setShowAnimation(bool) that emits showAnimationChanged.
    中文:新增仅供 C++ 使用的 GreeterProxy::setShowAnimation(bool),并发出 showAnimationChanged 信号。

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/seat/helper.cpp Adjusts lockscreen show flow based on greeter lock state.
src/plugins/lockscreen/qml/LockView.qml Initializes lockscreen UI behavior on component creation and centralizes lock state handling.
src/greeter/greeterproxy.h Declares setShowAnimation(bool) with documentation.
src/greeter/greeterproxy.cpp Implements setShowAnimation(bool) and emits change notification.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

The LockView.qml (in fact the whole lockscreen component in Greeter.qml)
is re-created after switch back from tty, as the output is exactly being
removed and re-added once. So that we cannot use property listener for
displaying lockscreen as usual.

This will work as intended.
}
}

Component.onCompleted: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥是默认传递true?不应该根据GreeterProxy里保存的状态来吗?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LockView的创建分为两种场景:一种是在treeland刚启动的时候,另一种是在output被(重新)添加的时候。tty切换是第二种场景。如果在这里直接读取GreeterProxy的状态的话,会在第一种场景下报错,可能是QML组件的创建和引用的顺序的问题。这里这样写实际上会在两种场景下都表现正确,因为这两种情况都会立即显示锁屏,而我们目前没有第三种情况,算是代码侵入性小但不治本的一种方法qwq

如果您希望的话我去研究一下GreeterProxy的初始化时序问题,换一种方式改?

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: calsys456

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-bot
Copy link
Copy Markdown

deepin-bot bot commented Mar 6, 2026

TAG Bot

New tag: 0.8.5
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants