Skip to content

fix(output): keep copy mode when switching display parameters - #1331

Closed
Groveer wants to merge 1 commit into
linuxdeepin:masterfrom
Groveer:wt/fix-refresh
Closed

fix(output): keep copy mode when switching display parameters#1331
Groveer wants to merge 1 commit into
linuxdeepin:masterfrom
Groveer:wt/fix-refresh

Conversation

@Groveer

@Groveer Groveer commented Aug 25, 2026

Copy link
Copy Markdown
Contributor
  1. In copy mode, treat wlr-output-management requests that only change display parameters (mode/refresh/scale) as non-topology changes and keep the mirror setup, instead of always converting mirror outputs to normal outputs and leaving copy mode.
  2. Only tear down copy mode when an output is actually enabled/disabled; layout positions are ignored because the client may send positions remembered from a previous extension layout.
  3. Only clear the persisted copy configuration when copy mode is really left, so a pure refresh-rate switch keeps the mirror topology.

Log: fix mirror output being broken after switching refresh rate in copy mode

Influence:

  1. Enter copy mode, switch refresh rate, verify both screens stay mirrored
  2. Enter copy mode, adjust positions in extension mode first, then switch refresh rate, verify mirror topology survives
  3. Disable/enable an output in copy mode, verify it exits to extension mode as before

fix(output): 复制模式下切换显示参数时保持复制模式

  1. 复制模式下,仅改变显示参数(mode/refresh/scale)的输出管理请求不再 被当作拓扑变化处理,保持镜像输出不被拆分。
  2. 仅当输出被真正启用或禁用时才退出复制模式;不再比较布局位置,因为 客户端可能发送扩展布局时记忆的位置。
  3. 仅真正退出复制模式时才清除持久化的复制配置,纯刷新率切换保留镜像拓扑。

Log: 修复复制模式下切换刷新率后镜像输出被破坏的问题

Influence:

  1. 进入复制模式后切换刷新率,验证两屏仍保持镜像
  2. 先在扩展模式调整屏幕位置再进入复制模式,切换刷新率,验证镜像拓扑保留
  3. 在复制模式下禁用/启用某输出,验证仍按原逻辑退出为扩展模式

PMS: BUG-374563

Summary by Sourcery

Keep copy mode intact during display-parameter changes while retaining the existing transition to extension mode for output enablement changes.

Bug Fixes:

  • Preserve mirror topology when output-management requests only change display parameters such as mode, refresh rate, or scale.
  • Exit copy mode only when an output is actually enabled or disabled, while ignoring stale layout positions.
  • Retain persisted copy configuration across display-parameter changes and clear it only after copy mode is truly exited.

1. In copy mode, treat wlr-output-management requests that only change
   display parameters (mode/refresh/scale) as non-topology changes and
   keep the mirror setup, instead of always converting mirror outputs to
   normal outputs and leaving copy mode.
2. Only tear down copy mode when an output is actually enabled/disabled;
   layout positions are ignored because the client may send positions
   remembered from a previous extension layout.
3. Only clear the persisted copy configuration when copy mode is really
   left, so a pure refresh-rate switch keeps the mirror topology.

Log: fix mirror output being broken after switching refresh rate in copy mode

Influence:
1. Enter copy mode, switch refresh rate, verify both screens stay mirrored
2. Enter copy mode, adjust positions in extension mode first, then switch
   refresh rate, verify mirror topology survives
3. Disable/enable an output in copy mode, verify it exits to extension mode
   as before

fix(output): 复制模式下切换显示参数时保持复制模式

1. 复制模式下,仅改变显示参数(mode/refresh/scale)的输出管理请求不再
   被当作拓扑变化处理,保持镜像输出不被拆分。
2. 仅当输出被真正启用或禁用时才退出复制模式;不再比较布局位置,因为
   客户端可能发送扩展布局时记忆的位置。
3. 仅真正退出复制模式时才清除持久化的复制配置,纯刷新率切换保留镜像拓扑。

Log: 修复复制模式下切换刷新率后镜像输出被破坏的问题

Influence:
1. 进入复制模式后切换刷新率,验证两屏仍保持镜像
2. 先在扩展模式调整屏幕位置再进入复制模式,切换刷新率,验证镜像拓扑保留
3. 在复制模式下禁用/启用某输出,验证仍按原逻辑退出为扩展模式

PMS: BUG-374563
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Groveer

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 Aug 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates output-management handling so mode, refresh-rate, scale, and stale layout-position changes do not dismantle copy mode; copy mode is now exited only for actual output enable/disable changes, with persisted copy configuration retained accordingly.

Sequence diagram for preserving copy mode during output configuration

sequenceDiagram
    participant Client
    participant Helper
    participant CopyOutputs
    participant CopyConfig

    Client->>Helper: onOutputTestOrApply(config, onlyTest)
    Helper->>Helper: inspect output enabled state
    alt output enabled state changed
        Helper->>CopyOutputs: convert copy proxies to normal outputs
        Helper->>Helper: outputModeChanged()
        Helper->>CopyConfig: clearCopyModeRestoreIntent()
    else only mode, refresh, scale, or position changed
        Helper->>CopyOutputs: keep mirror topology
        Helper->>CopyConfig: clearCopyModeRestoreIntent()
    end
    Helper->>Helper: onOutputCommitFinished(config, success)
    alt m_mode != OutputMode::Copy
        Helper->>CopyConfig: storeCopyOutputConfig(false)
    else m_mode == OutputMode::Copy
        Helper->>CopyConfig: retain persisted copy configuration
    end
Loading

File-Level Changes

Change Details Files
Classify output-management requests by actual enablement changes so display-parameter updates preserve copy topology.
  • Compare requested enabled state with the current output state to detect topology changes.
  • Keep copy proxies and copy mode for mode, refresh-rate, scale, and position-only updates.
  • Convert copy outputs back to normal outputs and switch to extension mode only after an enable/disable change.
src/seat/helper.cpp
Preserve persisted copy configuration until copy mode is genuinely exited.
  • Clear the stored copy configuration only when the completed transaction is no longer in copy mode.
  • Retain the copy restore configuration after successful display-parameter changes.
src/seat/helper.cpp

Possibly linked issues

  • #多屏问题整理: PR修复复制模式切换刷新率、模式或缩放参数后镜像被破坏,属于复制模式显示参数异常。

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="src/seat/helper.cpp" line_range="1082-1083" />
<code_context>
-            Output *copyOutput = m_outputList.at(i);
-            if (copyOutput->isSource()) {
-                continue;
+        // A refresh-rate / mode switch is a display-parameter change, not a
+        // topology change. Keep copy mode unless an output is enabled/disabled.
+        bool topologyChanged = false;
+        for (const auto &state : std::as_const(states)) {
</code_context>
<issue_to_address>
**issue (broader_impact):** A copy-mode request that changes only mode/refresh/scale is classified as non-topology-changing, but its remembered `state.x`/`state.y` values are still applied later by `layout->move()`. When the client sends positions from a previous extension layout, copy outputs are moved away from their mirror layout while `m_mode` remains `Copy`, breaking the mirror topology.

**Triggers:** When a client submits a mode, refresh-rate, or scale change together with nonzero positions remembered from extension mode.

**Suggested fix:** Do not apply output-management positions while retaining copy mode; only move outputs after converting the copy proxies to normal outputs for a real enable/disable topology change.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/seat/helper.cpp
@zccrs
zccrs requested a review from zzxyb August 25, 2026 07:18
@Groveer
Groveer marked this pull request as draft August 26, 2026 05:55
@deepin-bot

deepin-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.9.1
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1348

@Groveer

Groveer commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

use:#1380

@Groveer Groveer closed this Sep 8, 2026
@Groveer
Groveer deleted the wt/fix-refresh branch September 10, 2026 02:20
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