fix(output): sync output item DPR on scale change synchronously - #1310
fix(output): sync output item DPR on scale change synchronously#1310deepin-wm wants to merge 3 commits into
Conversation
1. Remove the devicePixelRatio QML binding that was evaluated lazily,
causing a transient mismatch with the window DPR on scale commit.
2. Manage the output item devicePixelRatio from C++ via a direct
connection to WOutput::scaleChanged, keeping it in sync with the
render window effectiveDevicePixelRatio.
3. Apply the same pattern to both PrimaryOutput and CopyOutput items.
Log: Fix greeter login window appearing at the wrong size at startup
when screen scaling is not 100%.
Influence:
1. Verify greeter/lock screen shows at correct size on startup with
fractional scaling (e.g. 150%, 125%).
2. Verify no visual glitch when switching between different scale
factors at runtime.
3. Verify copy (mirror) output also renders correctly at non-100%
scale.
fix(output): 同步输出项缩放比例更新,消除启动时窗口尺寸抖动
1. 移除延迟求值的 devicePixelRatio QML 绑定,该绑定在缩放提交时
与窗口 DPR 存在短暂不一致。
2. 通过 WOutput::scaleChanged 的 C++ 直连信号同步更新输出项缩放。
3. 同时应用于主屏和复制屏输出项。
Log: 修复屏幕缩放非 100% 时启动 greeter 登录窗口先变大再变小的
问题。
Influence:
1. 验证启动时 greeter/锁屏界面在分数缩放下尺寸正确。
2. 验证运行时切换缩放比例无界面抖动。
3. 验证复制屏在非 100% 缩放下显示正常。
Fixes: WM-306
|
[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 guide (collapsed on small PRs)Reviewer's GuideSynchronizes OutputItem devicePixelRatio with WOutput scale in C++ instead of via lazy QML bindings, preventing a transient size mismatch for greeter/login windows when output scale changes, including for mirrored outputs. Sequence diagram for synchronous devicePixelRatio updates on WOutput scale changessequenceDiagram
participant WOutput
participant Output
participant OutputItem
Note over Output: During Output::create / Output::createCopy
Output->>OutputItem: setDevicePixelRatio(output->scale())
Note over WOutput,OutputItem: On runtime scale change
WOutput-->>Output: scaleChanged
Output-->>OutputItem: setDevicePixelRatio(output->scale())
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- When connecting
WOutput::scaleChangedto the lambda, consider using the overload that takesoutputItemas the context object (e.g.QObject::connect(output, &WOutput::scaleChanged, outputItem, [outputItem, output] { ... });) so the connection is automatically severed if theOutputItemis destroyed and you avoid potential use-after-free captures. - The DPR sync logic in
Output::createandOutput::createCopyis now duplicated; consider extracting a small helper (e.g.setupDevicePixelRatioSync(output, outputItem)) to keep the behavior consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- When connecting `WOutput::scaleChanged` to the lambda, consider using the overload that takes `outputItem` as the context object (e.g. `QObject::connect(output, &WOutput::scaleChanged, outputItem, [outputItem, output] { ... });`) so the connection is automatically severed if the `OutputItem` is destroyed and you avoid potential use-after-free captures.
- The DPR sync logic in `Output::create` and `Output::createCopy` is now duplicated; consider extracting a small helper (e.g. `setupDevicePixelRatioSync(output, outputItem)`) to keep the behavior consistent and easier to maintain.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
The license-check CI verifies that SPDX copyright headers use a year range spanning both the file creation and latest modification year. CopyOutput.qml was created in 2024 and modified in 2026, but its header only listed "2024", causing the license-check workflow to fail. Update the copyright year to "2024-2026" to match PrimaryOutput.qml and pass the check. Log: 修复CopyOutput.qml版权年份不符合license-check要求的问题
The OutputViewport's devicePixelRatio was still set via a lazy QML binding (devicePixelRatio: parent.devicePixelRatio), causing a transient size mismatch at fractional scales. The viewport's implicit size is output->size() / DPR, so a stale DPR makes it larger than its parent OutputItem, and with anchors.centerIn the content is offset — the greeter flashes from bottom-right to center at startup under 1.25 scaling. Remove the QML binding and sync the viewport DPR from C++ in Output::create() and Output::createCopy(), same pattern as the OutputItem DPR fix. Log: 修复greeter在分数缩放下的位置偏移问题
0ba1a5b to
78cd07a
Compare
|
TAG Bot New tag: 0.9.0 |
|
TAG Bot New tag: 0.9.1 |
Summary
Fix the greeter/login window appearing at the wrong size (first larger, then smaller) at treeland startup when screen scaling is not 100%.
Root cause
The
OutputItem'sdevicePixelRatiowas bound in QML tooutput?.scale. QML bindings are evaluated lazily. When the output scale is committed (e.g. 150%) at startup, the render window'seffectiveDevicePixelRatiowas updated synchronously in C++ (viaupdateSceneDPRonscaleChanged), while the output item's size still reflected the old scale for a frame or more. Since the greeter/lock screen binds its size to the output item, this transient mismatch made the login window render at the wrong size first, then shrink to the correct size. At 100% scaling there is no scale change, so no glitch occurs.Fix
devicePixelRatiobinding inPrimaryOutput.qmlandCopyOutput.qml.devicePixelRatiofrom C++ inOutput::create()andOutput::createCopy(), in lockstep with the window DPR change onWOutput::scaleChanged.Test Plan
issue-key: WM-306
Summary by Sourcery
Bug Fixes: