Skip to content

fix: fix wallpaper-only display after lid reopen#1015

Draft
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/167e1def
Draft

fix: fix wallpaper-only display after lid reopen#1015
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/167e1def

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the issue where only wallpaper is displayed after reopening the laptop lid.

Changes

  1. onSetOutputPowerMode MODE_ON: Restore current mode and scale when re-enabling output, and call schedule_frame() after successful commit to trigger render pipeline recovery.
  2. onPrepareForSleep(false): Iterate all enabled outputs to call scheduleFrame() and trigger m_renderWindow->update() for full repaint after resume.
  3. LockScreen::addOutput: Connect WOutput::enabledChanged signal to reconfigure ext_session_lock_v1 lock surface size and update DDM lockscreen component size when output re-enables.

Root Cause

When the laptop lid is closed and reopened, the render pipeline is not fully restored:

  • onSetOutputPowerMode only sets enabled=true without restoring mode/scale or triggering frame scheduling
  • onPrepareForSleep(false) only calls enableRender() without scheduling frames or triggering repaint
  • LockScreen doesn't listen for output re-enable events, causing lock surface state inconsistency

Fixes: #WM-37

Summary by Sourcery

Ensure display and lockscreen state are fully restored after outputs are re-enabled from power events such as lid reopen or resume from sleep.

Bug Fixes:

  • Restore output mode and scale and schedule frame commits when turning an output back on via power management events to avoid wallpaper-only display after lid reopen.
  • Trigger frame scheduling and a full render window repaint when resuming from sleep so all enabled outputs repaint correctly.
  • Update lockscreen surfaces and component sizes when an output is re-enabled to keep the lockscreen layout consistent across outputs.

@sourcery-ai

sourcery-ai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Ensures outputs fully restore mode/scale and repaint after lid reopen or resume, and keeps lockscreen surfaces/components in sync when outputs are re‑enabled to fix the wallpaper‑only display issue.

Sequence diagram for output re-enable via onSetOutputPowerMode MODE_ON

sequenceDiagram
    participant PowerManager as wlr_output_power_v1
    participant Helper as Helper
    participant WlrOutput as wlr_output
    participant WOutputObj as WOutput

    PowerManager->>Helper: onSetOutputPowerMode(event)
    Helper->>WlrOutput: enabled?
    alt output_disabled
        Helper->>WlrOutput: preferred_mode()
        Helper->>WlrOutput: commit_state(newState with mode, scale, enabled=true)
        alt commit_success
            Helper->>WlrOutput: schedule_frame()
        else commit_failed
            Helper-->>PowerManager: log commit failed
        end
    else output_already_enabled
        Helper-->>PowerManager: return
    end
Loading

Sequence diagram for resume handling in Helper::onPrepareForSleep(false)

sequenceDiagram
    participant System as SystemPower
    participant Helper as Helper
    participant OutputWrapper as OutputWrapper
    participant WOutputObj as WOutput
    participant RenderWindow as RenderWindow

    System->>Helper: onPrepareForSleep(false)
    Helper->>Helper: enableRender()
    loop for each o in m_outputList
        Helper->>OutputWrapper: output()
        alt output_enabled
            Helper->>WOutputObj: scheduleFrame()
        end
    end
    Helper->>RenderWindow: update()
Loading

Sequence diagram for LockScreen reacting to WOutput::enabledChanged

sequenceDiagram
    participant WOutputObj as WOutput
    participant LockScreen as LockScreen
    participant OutputWrapper as Output
    participant LockSurface as ext_session_lock_v1_surface
    participant Component as LockComponent
    participant Window as RenderWindow

    WOutputObj->>LockScreen: enabledChanged()
    alt output_enabled_and_locked
        LockScreen->>OutputWrapper: outputItem()
        alt outputItem_exists
            LockScreen->>LockSurface: configureSize(outputItem->size())
        end
        LockScreen->>Component: setSize(outputItem->size())
        LockScreen->>Window: update()
    else not_enabled_or_not_locked
        LockScreen-->>WOutputObj: return
    end
Loading

File-Level Changes

Change Details Files
Restore output mode/scale and trigger frame scheduling when powering outputs back on.
  • When handling MODE_ON in onSetOutputPowerMode, set a mode if current_mode is null using the output’s preferred mode.
  • Derive an Output object from the wlroots handle and set the output scale using preferredScaleFactor based on the current dimensions, if available.
  • After successfully committing the new output state, immediately call schedule_frame() to restart the render pipeline.
src/seat/helper.cpp
Trigger a full repaint and frame scheduling after resuming from sleep/hibernate.
  • After re‑enabling rendering in onPrepareForSleep(false), iterate m_outputList and call scheduleFrame() for all enabled outputs.
  • Request a repaint on m_renderWindow by calling update() to ensure the scene is fully redrawn after resume.
src/seat/helper.cpp
Update lockscreen surfaces and components whenever an output is re‑enabled.
  • In LockScreen::addOutput, connect to WOutput::enabledChanged and early‑return if the output is disabled or the compositor is not in a locked state.
  • When an output is (re)enabled and locked, reconfigure the ext_session_lock_v1 lock surface size to match the output item size, if present.
  • Adjust the corresponding lockscreen component size to the output item size and call Helper::instance()->window()->update() to repaint the lockscreen.
src/core/lockscreen.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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. 测试休眠/唤醒循环,验证渲染管线完整恢复
@deepin-wm deepin-wm force-pushed the agent/git-commit/167e1def branch from 238cc2d to 7fa1c77 Compare June 18, 2026 12:14
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[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.

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

1 similar comment
@deepin-ci-robot

Copy link
Copy Markdown

[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.

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

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.

2 participants