Skip to content

fix: keep oversized surfaces on target output#1079

Merged
Groveer merged 1 commit into
linuxdeepin:masterfrom
wineee:oversized
Jul 1, 2026
Merged

fix: keep oversized surfaces on target output#1079
Groveer merged 1 commit into
linuxdeepin:masterfrom
wineee:oversized

Conversation

@wineee

@wineee wineee commented Jul 1, 2026

Copy link
Copy Markdown
Member
  1. Replace qBound with explicit boundary checks when moving surfaces between outputs

  2. Keep oversized surfaces anchored to the target output top-left when they cannot fit inside the screen

  3. Avoid qBound assertion when surface size is larger than target output geometry

Log: Fixed oversized surface positioning during output migration

Influence:

  1. Test moving windows larger than the target output between screens

ISSUE: 1078

Summary by Sourcery

Bug Fixes:

  • Prevent assertions when moving surfaces larger than the target output geometry by clamping their position within valid bounds.

Fix: 1078

1. Replace qBound with explicit boundary checks when moving surfaces between outputs

2. Keep oversized surfaces anchored to the target output top-left when they cannot fit inside the screen

3. Avoid qBound assertion when surface size is larger than target output geometry

Log: Fixed oversized surface positioning during output migration

Influence:

1. Test moving windows larger than the target output between screens

ISSUE: 1078
@sourcery-ai

sourcery-ai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts surface repositioning when moving between outputs by replacing qBound-based clamping with explicit boundary checks and ensuring oversized surfaces remain anchored to the target output’s top-left within its geometry constraints.

Flow diagram for updated surface repositioning on output move

flowchart TD
    A[newPos computed from targetGeometry.center and relativePos] --> B{newPos.x + size.width > targetGeometry.right}
    B -- yes --> C[set newPos.x to targetGeometry.right - size.width]
    B -- no --> D{newPos.x < targetGeometry.left}
    C --> D
    D -- yes --> E[set newPos.x to targetGeometry.left]
    D -- no --> F[newPos.x unchanged]

    F --> G{newPos.y + size.height > targetGeometry.bottom}
    G -- yes --> H[set newPos.y to targetGeometry.bottom - size.height]
    G -- no --> I{newPos.y < targetGeometry.top}
    H --> I
    I -- yes --> J[set newPos.y to targetGeometry.top]
    I -- no --> K[newPos.y unchanged]

    J --> L["call surface.setPosition(newPos)"]
    K --> L
Loading

File-Level Changes

Change Details Files
Replace qBound-based clamping with explicit boundary checks to keep surfaces within the target output, including oversized surfaces.
  • Compute new surface position relative to target output center as before
  • Clamp X coordinate by checking right overflow (newPos.x + width > right) and then left underflow (newPos.x < left)
  • Clamp Y coordinate by checking bottom overflow (newPos.y + height > bottom) and then top underflow (newPos.y < top)
  • Ensure surfaces larger than the target geometry are anchored to the output’s top-left without triggering qBound assertions
src/core/rootsurfacecontainer.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

@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 left some high level feedback:

  • Consider explicitly branching for the oversized-surface case (e.g., if size.width() >= targetGeometry.width(), set x directly to targetGeometry.left()) to avoid computing intermediate values like targetGeometry.right() - size.width() that are known to be off-screen and to better document the intended anchoring behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider explicitly branching for the oversized-surface case (e.g., if size.width() >= targetGeometry.width(), set x directly to targetGeometry.left()) to avoid computing intermediate values like targetGeometry.right() - size.width() that are known to be off-screen and to better document the intended anchoring behavior.

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.

@Groveer Groveer merged commit 2c18649 into linuxdeepin:master Jul 1, 2026
9 checks passed
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Groveer, wineee

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

@wineee wineee deleted the oversized branch July 1, 2026 09:13
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