fix: implement Wayland screen-off in systemTurnOffScreen#89
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm 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 |
Reviewer's GuideImplements the previously missing Wayland/Treeland code path for systemTurnOffScreen by wiring it through Deepin’s Power1 DBus API, wrapping it with suspend-preparation calls, optional lock-before-off behavior, and a small delay to allow the lock UI to render, plus persisting a simple DPMS state marker file. Sequence diagram for updated Wayland systemTurnOffScreen flowsequenceDiagram
participant PowerController
participant DConfig
participant Power1_DBUS as Power1_DBus
participant QFile_dpms as QFile_dpms_state
PowerController->>PowerController: doPrepareSuspend()
PowerController->>DConfig: createPowerConfig(this)
PowerController->>DConfig: shouldLockOnScreenBlack(config)
alt [screenBlackLock]
PowerController->>PowerController: doLock(true)
PowerController->>PowerController: QThread::msleep(500)
end
PowerController->>Power1_DBUS: QDBusInterface(...)
alt [Power1_DBUS isValid]
PowerController->>Power1_DBUS: call(TurnOffScreen)
else [Power1_DBUS invalid]
PowerController->>PowerController: qWarning(...Power1 unavailable...)
end
PowerController->>PowerController: undoPrepareSuspend()
PowerController->>QFile_dpms: open(WriteOnly | Truncate)
alt [open successful]
PowerController->>QFile_dpms: write(1)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Replace TODO placeholder in systemTurnOffScreen() Wayland branch with working implementation 2. Add doPrepareSuspend/undoPrepareSuspend to prevent idle watcher race during screen-off transition 3. Lock screen before turning off if screenBlackLock config is true 4. Call Power1 TurnOffScreen via systemBus DBus for wlr-output-power-management-v1 output control 5. Add 500ms delay after lock for lock UI rendering Log: Fixed power button screen-off not working on Wayland/Treeland Influence: 1. Test power button screen-off in Treeland session 2. Verify lock screen appears before display turns off 3. Test wake from screen-off resumes to lock screen 4. Verify X11 screen-off path is not affected fix: 实现 Wayland 熄屏功能 1. 替换 systemTurnOffScreen() Wayland 分支的 TODO 占位符为完整实现 2. 添加 doPrepareSuspend/undoPrepareSuspend 防止 熄屏过渡期间 idle watcher 冲突 3. 熄屏前根据 screenBlackLock 配置判断是否先锁屏 4. 通过 systemBus DBus 调用 Power1 TurnOffScreen 使用 wlr-output-power-management-v1 关闭显示器 5. 锁屏后延迟 500ms 等待锁屏 UI 渲染完成 Log: 修复 Wayland/Treeland 下按电源键熄屏无响应的问题 Influence: 1. 在 Treeland 会话下测试按电源键熄屏功能 2. 验证熄屏前锁屏界面正常显示 3. 测试从熄屏唤醒后回到锁屏界面 4. 验证 X11 熄屏路径不受影响 PMS: BUG-209669
b5f8586 to
d76c15e
Compare
Summary
Replace the TODO placeholder in
systemTurnOffScreen()Wayland branch with a working implementation for Treeland/Wayland.Changes
systemTurnOffScreen()Wayland branchdoPrepareSuspend()/undoPrepareSuspend()to prevent idle watcher raceshouldLockOnScreenBlackis truePower1.TurnOffScreen()via DBus forwlr-output-power-management-v1Flow
Related
PMS: BUG-209669
Issue: WM-50
Summary by Sourcery
Implement Wayland/Treeland screen-off behavior in systemTurnOffScreen using the Power1 DBus interface and suspend preparation hooks.
Bug Fixes:
Enhancements: