From 7fa1c779f14bb9150ea7564e5ec55f7b1e7572c3 Mon Sep 17 00:00:00 2001 From: deepin-wm Date: Thu, 18 Jun 2026 20:02:08 +0800 Subject: [PATCH] fix: fix wallpaper-only display after lid reopen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Restore current mode and scale in onSetOutputPowerMode MODE_ON branch, and call schedule_frame after commit 2. Iterate outputs to call scheduleFrame and trigger m_renderWindow->update() in onPrepareForSleep(false) 3. Connect WOutput::enabledChanged in LockScreen::addOutput to reconfigure lock surface and update DDM lockscreen component size when output re-enables Log: Fixed the issue where only wallpaper is displayed after reopening the laptop lid Influence: 1. Test laptop lid close and reopen, verify full desktop restores 2. Test with lock screen enabled, verify lock screen renders correctly after reopen 3. Test DPMS off/on cycle, verify output mode and scale are restored 4. Test suspend/resume cycle, verify rendering pipeline fully recovers fix: 修复合盖后重开只显示壁纸的问题 1. 在 onSetOutputPowerMode 的 MODE_ON 分支恢复 current mode 和 scale,commit 成功后调用 schedule_frame 2. 在 onPrepareForSleep(false) 中遍历 outputs 调用 scheduleFrame,并触发 m_renderWindow->update() 3. 在 LockScreen::addOutput 中连接 WOutput::enabledChanged 信号,当 output 重新启用时重新配置 lock surface 和 更新 DDM 锁屏组件尺寸 Log: 修复合盖后重开只显示壁纸的问题 Influence: 1. 测试笔记本合盖后重开,验证完整桌面恢复 2. 测试锁屏状态下合盖重开,验证锁屏正确渲染 3. 测试 DPMS 关闭/开启循环,验证输出模式和缩放恢复 4. 测试休眠/唤醒循环,验证渲染管线完整恢复 --- src/core/lockscreen.cpp | 21 +++++++++++++++++++++ src/seat/helper.cpp | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/core/lockscreen.cpp b/src/core/lockscreen.cpp index 9fb6cde54..9390678d5 100644 --- a/src/core/lockscreen.cpp +++ b/src/core/lockscreen.cpp @@ -9,6 +9,7 @@ #include "utils/cmdline.h" #include "common/treelandlogging.h" #include "greeter/greeterproxy.h" +#include #ifdef EXT_SESSION_LOCK_V1 #include @@ -96,6 +97,26 @@ void LockScreen::addOutput(Output *output) Q_ASSERT(ok); #endif + connect(output->output(), &WOutput::enabledChanged, this, [this, output]() { + if (!output->output()->isEnabled() || !isLocked()) { + return; + } +#if EXT_SESSION_LOCK_V1 + auto outputItem = output->outputItem(); + if (outputItem) { + auto *lockSurface = m_lockSurfaces[outputItem].get(); + if (lockSurface) { + lockSurface->configureSize(outputItem->size().toSize()); + } + } +#endif + auto it = m_components.find(output); + if (it != m_components.end() && it->second) { + it->second->setSize(output->outputItem()->size()); + } + Helper::instance()->window()->update(); + }); + if (!m_impl) { return; } diff --git a/src/seat/helper.cpp b/src/seat/helper.cpp index 369aed990..121c53d1f 100644 --- a/src/seat/helper.cpp +++ b/src/seat/helper.cpp @@ -936,9 +936,23 @@ void Helper::onSetOutputPowerMode(wlr_output_power_v1_set_mode_event *event) if (output->handle()->enabled) { return; } + if (!output->handle()->current_mode) { + auto mode = output->preferred_mode(); + if (mode) { + newState.set_mode(mode); + } + } + auto outputObj = getOutput(WOutput::fromHandle(output)); + if (outputObj) { + newState.set_scale(outputObj->preferredScaleFactor(output->handle()->width > 0 + ? QSize(output->handle()->width, output->handle()->height) + : QSize())); + } newState.set_enabled(true); if (!output->commit_state(newState)) { qCCritical(lcTlCore, "commit failed on output %s", output->handle()->name); + } else { + output->schedule_frame(); } break; } @@ -2773,6 +2787,12 @@ void Helper::onPrepareForSleep(bool sleep) } else { qCInfo(lcTlCore) << "Re-enabled rendering after hibernate"; enableRender(); + for (auto o : std::as_const(m_outputList)) { + if (o && o->output() && o->output()->isEnabled()) { + o->output()->scheduleFrame(); + } + } + m_renderWindow->update(); } }