Skip to content

fix(dde-blackwidget): align shutdown logo size with plymouth - #456

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:bug/scale
Sep 22, 2026
Merged

mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:bug/scale

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor
  1. Replicate plymouth's device-scale heuristic (physical DPI > 192 → 2) to size the logo
  2. Read panel native resolution via XRandR preferred mode instead of Qt logical size
  3. Scale logo by device-scale × (X resolution / native) so it stays consistent after resolution changes
  4. Render the logo on every screen with each screen's own scale

Log: Align the shutdown black-screen logo size with plymouth on HiDPI and multi-screen setups
Influence: Shutdown logo matches plymouth at any resolution

fix(dde-blackwidget): 修复关机黑屏 logo 大小与 plymouth 不一致

  1. 复刻 plymouth 的 device scale 判定(物理 DPI > 192 → 2)来确定 logo 尺寸
  2. 用 XRandR 首选模式读取面板原生分辨率,替代 Qt 逻辑尺寸
  3. 按 device scale × (X 分辨率 / 原生分辨率) 缩放 logo,降分辨率后仍与 plymouth 一致
  4. 每个屏幕都渲染 logo,并按各屏自身缩放

Log: 修复关机黑屏 logo 在高分屏及多屏下与 plymouth 大小不一致的问题
PMS: BUG-377849
Influence: 关机 logo 在不同分辨率下均与 plymouth 对齐

Summary by Sourcery

Align shutdown logo rendering with Plymouth across display scaling, resolution, and multi-screen setups.

Bug Fixes:

  • Align the shutdown black-screen logo with Plymouth across HiDPI displays, resolution changes, and multi-screen configurations.

Enhancements:

  • Use display-native resolution and physical DPI to calculate per-screen logo sizing and render appropriately scaled logos on every connected screen.

Build:

  • Add the XRandR dependency required for native display mode detection.

@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR aligns shutdown logos with Plymouth by deriving per-screen native resolution and HiDPI scale through XRandR/EDID data, compensating for runtime resolution changes, and rendering independently scaled logos across multi-screen cover windows.

Sequence diagram for per-screen shutdown logo rendering

sequenceDiagram
    participant BlackWidget
    participant QScreen
    participant XRandR
    participant ScreenLogo

    BlackWidget->>QScreen: makeLogoPixmap(screen)
    QScreen->>XRandR: nativeResolution(screen)
    XRandR-->>QScreen: preferred native mode
    QScreen-->>BlackWidget: device scale and resolution factor
    BlackWidget->>ScreenLogo: setPixmap(scaled logo)
    BlackWidget->>ScreenLogo: setFixedSize and center
    BlackWidget->>ScreenLogo: setVisible(m_logoVisible)
Loading

File-Level Changes

Change Details Files
Add XRandR-backed native-resolution detection and Plymouth-compatible DPI scaling for logo sizing.
  • Add the XRandR build dependency and headers.
  • Resolve each connected screen’s preferred XRandR mode, with a Qt size/device-pixel-ratio fallback.
  • Apply a device scale of 2 only for sufficiently high native resolution and physical DPI, then adjust for the current X resolution.
  • Set pixmap device-pixel ratios and account for them when sizing the QLabel.
dde-blackwidget/CMakeLists.txt
dde-blackwidget/src/window.cpp
Render and manage a separately scaled shutdown logo on every screen.
  • Create a logo QLabel for each cover window and position it at that screen’s center.
  • Use each screen’s computed pixmap scale and device pixel ratio.
  • Synchronize logo visibility with cover-window visibility and clean up logo mappings when windows are removed.
dde-blackwidget/src/window.cpp
dde-blackwidget/src/window.h
Declare the new runtime/build dependency required for XRandR integration.
  • Add the XRandR package dependency to Debian control metadata.
debian/control

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 1 issue

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

## Individual Comments

### Comment 1
<location path="dde-blackwidget/src/window.cpp" line_range="248" />
<code_context>
         m_logo->setAccessibleName("BlackWidgetLogo");
         m_logo->setVisible(false);
-        QPixmap logoPixmap(plymouthLogoPath());
+        const QPixmap logoPixmap = makeLogoPixmap(qApp->primaryScreen());
         if (logoPixmap.isNull()) {
             qWarning() << "blackwidget logo pixmap is null";
</code_context>
<issue_to_address>
**issue (broader_impact):** The primary-screen logo is scaled only when it is first created, so after the primary screen, resolution, device pixel ratio, or preferred mode changes, the logo keeps the old screen's pixmap dimensions and no longer matches plymouth. `updateScreenWindows()` refreshes only the secondary-screen logos.

**Triggers:** When the display configuration changes after `setLogoVisible(true)` has created `m_logo`.

**Suggested fix:** Recreate or rescale `m_logo` for the current primary screen whenever screen geometry, DPR, or the preferred mode changes, alongside the secondary-screen refresh.
</issue_to_address>

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

Comment thread dde-blackwidget/src/window.cpp
1. Replicate plymouth's device-scale heuristic (physical DPI > 192 → 2) to size the logo
2. Read panel native resolution via XRandR preferred mode instead of Qt logical size
3. Scale logo by device-scale × (X resolution / native) so it stays consistent after resolution changes
4. Render the logo on every screen with each screen's own scale

Log: Align the shutdown black-screen logo size with plymouth on HiDPI and multi-screen setups
Influence: Shutdown logo matches plymouth at any resolution

fix(dde-blackwidget): 修复关机黑屏 logo 大小与 plymouth 不一致

1. 复刻 plymouth 的 device scale 判定(物理 DPI > 192 → 2)来确定 logo 尺寸
2. 用 XRandR 首选模式读取面板原生分辨率,替代 Qt 逻辑尺寸
3. 按 device scale × (X 分辨率 / 原生分辨率) 缩放 logo,降分辨率后仍与 plymouth 一致
4. 每个屏幕都渲染 logo,并按各屏自身缩放

Log: 修复关机黑屏 logo 在高分屏及多屏下与 plymouth 大小不一致的问题
PMS: BUG-377849
Influence: 关机 logo 在不同分辨率下均与 plymouth 对齐
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, robertkill

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

@mhduiy
mhduiy merged commit 42b8b4d into linuxdeepin:master Sep 22, 2026
12 of 14 checks passed
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.

3 participants