fix: lockscreen not shown after switch back from tty#761
fix: lockscreen not shown after switch back from tty#761calsys456 wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
There was a problem hiding this comment.
Sorry @calsys456, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
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 invokingm_lockScreen->lock()inHelper::showLockScreen().
中文:在Helper::showLockScreen()中调用m_lockScreen->lock()前新增GreeterProxy::isLocked()判断。 - Refactors
LockView.qmlto routeGreeterProxy.lockChangedinto a localonLockChanged()function and triggers it fromComponent.onCompleted.
中文:重构LockView.qml,将GreeterProxy.lockChanged的处理提取到本地onLockChanged(),并在Component.onCompleted时触发。 - Adds a C++-only setter
GreeterProxy::setShowAnimation(bool)that emitsshowAnimationChanged.
中文:新增仅供 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. |
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: { |
There was a problem hiding this comment.
为啥是默认传递true?不应该根据GreeterProxy里保存的状态来吗?
There was a problem hiding this comment.
LockView的创建分为两种场景:一种是在treeland刚启动的时候,另一种是在output被(重新)添加的时候。tty切换是第二种场景。如果在这里直接读取GreeterProxy的状态的话,会在第一种场景下报错,可能是QML组件的创建和引用的顺序的问题。这里这样写实际上会在两种场景下都表现正确,因为这两种情况都会立即显示锁屏,而我们目前没有第三种情况,算是代码侵入性小但不治本的一种方法qwq
如果您希望的话我去研究一下GreeterProxy的初始化时序问题,换一种方式改?
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
TAG Bot New tag: 0.8.5 |
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.