Skip to content

fix(dde-lowpower): support Wayland multi-screen fullscreen overlay - #480

Draft
Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/lowpower-wayland-fullscreen
Draft

Ivy233 wants to merge 1 commit into
linuxdeepin:masterfrom
Ivy233:fix/lowpower-wayland-fullscreen

Conversation

@Ivy233

@Ivy233 Ivy233 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

treeland 环境下低电量屏保未铺满整个屏幕,根因是 window.cpp 无条件使用
Qt::X11BypassWindowManagerHint(Wayland 下被忽略),修复方案参照 dde-blackwidget 的 Wayland 兼容实现。

  • 新增 isX11Platform() 平台检测
  • X11 保持原逻辑,Wayland 下不设置 X11BypassWindowManagerHint
  • Wayland 下调用 DPlatformWindowHandle::setWindowRadius(-1)
  • 多屏覆盖窗口管理(updateScreenWindows / setScreenWindowsVisible)
  • event() 重写处理 Show/Hide/WindowActivate/WindowDeactivate
  • 析构函数 qDeleteAll 清理覆盖窗口

Log: 修复treeland环境下低电量屏保未铺满整个屏幕的问题
PMS: BUG-294681

Summary by Sourcery

Enable low-power fullscreen overlays to cover all monitors reliably on Wayland while retaining X11 compatibility.

New Features:

  • Support fullscreen low-power overlays across multiple Wayland screens, including dynamic screen changes.

Bug Fixes:

  • Fix low-power screensavers not covering all displays in Treeland Wayland environments.

Enhancements:

  • Preserve the existing X11 overlay behavior while using Wayland-compatible layer-shell window handling and lifecycle synchronization.

Build:

  • Add the DDEShell dependency required by the Wayland overlay implementation.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ivy233

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

@sourcery-ai

sourcery-ai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add the platform handle and per-screen window state needed to manage Wayland overlays.

  • dde-lowpower/src/window.h L15-18, L27-31 (+3 small edits)

Implementation

Implement platform-specific fullscreen sizing, Wayland layer-shell setup, dynamic screen coverage, and overlay visibility lifecycle while preserving the X11 behavior.

  • dde-lowpower/src/window.cpp L41-63, L160-266, L279-316 (+9 small edits)

Configuration

Discover and link DDEShell so the low-power target can use Wayland layer-shell support.

  • CMakeLists.txt L51
  • dde-lowpower/CMakeLists.txt L1, L16, L23

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="dde-lowpower/src/window.cpp" line_range="137" />
<code_context>
+        move(primaryGeometry.topLeft());
+    }
+    if (size() != primaryGeometry.size()) {
+        setFixedSize(primaryGeometry.size());
+    }
+
</code_context>
<issue_to_address>
**Low-battery message disappears**

When the cursor is on a secondary screen or the primary screen has a nonzero virtual origin, `setupSize()` positions the image and text using screen-global coordinates as child-local coordinates, while `updateScreenWindows()` places the main window on the primary screen. The content lands outside the main window, and the secondary screen’s cover is black, so the low-battery message is missing.

Position the image and text using coordinates local to the main window, accounting for the window’s primary-screen position.

Also at `dde-lowpower/src/window.cpp:134`.
</issue_to_address>

### Comment 2
<location path="dde-lowpower/src/window.cpp" line_range="121" />
<code_context>

+void Window::updateScreenWindows()
+{
+    const QList<QScreen *> screens = qApp->screens();
+    if (screens.isEmpty()) {
+        return;
</code_context>
<issue_to_address>
**Changed displays remain uncovered**

When a screen is added, removed, resized, or rearranged while the overlay is visible, `updateScreenWindows()` only refreshes the cover windows during setup or show, and no topology or geometry-change handler calls it afterward. The cover windows retain stale sizes and positions or are missing, leaving desktop content exposed.

Refresh the cover windows when screens are added, removed, or have their geometry changed.

Also at `dde-lowpower/src/window.cpp:84`, `dde-lowpower/src/window.cpp:208-209`.
</issue_to_address>

### Comment 3
<location path="dde-lowpower/src/window.cpp" line_range="223-226" />
<code_context>
+    case QEvent::WindowDeactivate:
+        // Wayland: compositor may deactivate the window, re-raise after delay
+        if (!isHidden()) {
+            QTimer::singleShot(30, this, [this]() {
+                raise();
+                activateWindow();
+                setScreenWindowsVisible(true);
+            });
+        }
</code_context>
<issue_to_address>
**Hidden overlay leaves black screens**

When the main window is hidden during the 30 ms delay after `WindowDeactivate`, the delayed callback calls `setScreenWindowsVisible(true)` without checking whether the main window is still visible. The independent cover windows reappear while the main window stays hidden, leaving black screens visible.

Check that the main window is still visible before raising it or showing the cover windows in the delayed callback.
</issue_to_address>

### Comment 4
<location path="dde-lowpower/src/window.cpp" line_range="167-177" />
<code_context>
+    }
+
+    int coverIndex = 0;
+    for (QScreen *screen : screens) {
+        if (screen == primaryScreen) {
+            continue;
+        }
+
+        QWidget *screenWindow = m_screenWindows.at(coverIndex++);
</code_context>
<issue_to_address>
**Mirrored display hides the warning**

When the Wayland session is in mirrored/copy display mode and Qt reports multiple screens with the same geometry, `updateScreenWindows()` creates a black cover window for every screen except the primary and raises it over the main window. In mirror mode, screens share the same geometry, so the extra cover window obscures the low-battery image and text on the mirrored display.

Detect mirrored screens and avoid creating a separate black cover window for a screen whose geometry duplicates the primary screen.
</issue_to_address>

### Comment 5
<location path="dde-lowpower/src/window.cpp" line_range="221-227" />
<code_context>
+        }
+        break;
+    case QEvent::WindowDeactivate:
+        // Wayland: compositor may deactivate the window, re-raise after delay
+        if (!isHidden()) {
+            QTimer::singleShot(30, this, [this]() {
+                raise();
+                activateWindow();
+                setScreenWindowsVisible(true);
+            });
+        }
+        break;
</code_context>
<issue_to_address>
**X11 overlay steals focus back**

When the overlay loses activation on X11, the `WindowDeactivate` handler schedules `raise()` and `activateWindow()` without checking the platform, so an X11 window that loses activation takes focus back 30 ms later. Users cannot keep another window active while the low-power overlay is running, despite X11 being intended to retain its prior behavior.

Restrict the delayed re-raise behavior to non-X11 platforms, or otherwise preserve the previous X11 deactivation behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread dde-lowpower/src/window.cpp Resolved
Comment thread dde-lowpower/src/window.cpp Resolved
Comment thread dde-lowpower/src/window.cpp Resolved
Comment thread dde-lowpower/src/window.cpp Resolved
Comment thread dde-lowpower/src/window.cpp Resolved
@Ivy233
Ivy233 force-pushed the fix/lowpower-wayland-fullscreen branch 3 times, most recently from 7ffca9a to c954e93 Compare November 20, 2026 09:26
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

- Support Wayland multi-screen fullscreen overlay
- Use LayerOverlay and fix window radius for Treeland
- Fix include case and add null check for DLayerShellWindow
- Set exclusive zone -1 to cover full screen in Treeland

Log: Fix low power screensaver not covering full screen in Treeland environment
Bug: https://pms.uniontech.com/bug-view-294681.html
@Ivy233
Ivy233 force-pushed the fix/lowpower-wayland-fullscreen branch from 2499043 to 0480f49 Compare November 20, 2026 10:15
@Ivy233
Ivy233 marked this pull request as draft November 23, 2026 07:49
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