Skip to content

分屏动效与四分屏 - #1289

Open
glyvut wants to merge 2 commits into
linuxdeepin:masterfrom
glyvut:Tile
Open

分屏动效与四分屏#1289
glyvut wants to merge 2 commits into
linuxdeepin:masterfrom
glyvut:Tile

Conversation

@glyvut

@glyvut glyvut commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Add animated four-way edge tiling with configurable quadrant zones.

New Features:

  • Add four-corner tiling zones so dragged windows can tile into any quadrant of a display.
  • Animate edge-tile previews from the dragged window’s current geometry to the selected tile area.

Enhancements:

  • Make edge-tile detection configurable through a quadrant-zone ratio while preserving side and maximize behaviors.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: glyvut

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 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR adds configurable four-way corner tiling by classifying pointer positions within edge trigger zones, extends quick-tile geometry for the four quadrants, and implements an animated preview that transitions from the dragged window’s current geometry to the selected tile.

Sequence diagram for animated edge-tile preview

sequenceDiagram
    participant User
    participant SeatSurfaceManager
    participant RootSurfaceContainer
    participant EdgeTilePreview
    participant QuickTile

    User->>SeatSurfaceManager: Move window into edge zone
    SeatSurfaceManager->>RootSurfaceContainer: updateEdgeTilePreview(mode, output, seat)
    RootSurfaceContainer->>QuickTile: geometry(mode, output)
    QuickTile-->>RootSurfaceContainer: target tile geometry
    RootSurfaceContainer->>RootSurfaceContainer: moveResizeSurface()->geometry()
    RootSurfaceContainer->>EdgeTilePreview: set sourceGeometry and targetGeometry
    RootSurfaceContainer->>EdgeTilePreview: setVisible(true)
    EdgeTilePreview->>EdgeTilePreview: applyGeometry(sourceGeometry)
    EdgeTilePreview->>EdgeTilePreview: applyGeometry(targetGeometry)
    EdgeTilePreview-->>User: Animate preview to selected tile
Loading

Flow diagram for pointer-driven quadrant tiling

flowchart TD
    A[Pointer position during window move] --> B{Within edge trigger zone?}
    B -- No --> C[No edge tile mode]
    B -- Yes --> D{Edge and vertical zone}
    D -- Left + top --> E[TopLeft]
    D -- Left + middle --> F[Left]
    D -- Left + bottom --> G[BottomLeft]
    D -- Right + top --> H[TopRight]
    D -- Right + middle --> I[Right]
    D -- Right + bottom --> J[BottomRight]
    D -- Top edge --> K[Maximize]
Loading

File-Level Changes

Change Details Files
Add four-corner quick-tile modes and pointer-based quadrant detection.
  • Extend the tile mode enum and geometry calculation with top-left, top-right, bottom-left, and bottom-right layouts.
  • Use a configurable fraction of the output height to classify top and bottom zones on the left and right edges.
  • Keep top-edge detection mapped to maximize and preserve edge sampling for corner modes.
misc/dconfig/org.deepin.dde.treeland.user.json
src/surface/quicktile.h
src/surface/quicktile.cpp
src/core/rootsurfacecontainer.cpp
Animate edge-tile previews from the dragged window to the selected tile geometry.
  • Store source and target geometries on the QML preview and animate position and size with easing.
  • Initialize the preview at the dragged surface geometry when shown, then transition to the target tile.
  • Pass the active seat through preview updates to obtain the moving surface geometry.
src/core/qml/EdgeTilePreview.qml
src/core/rootsurfacecontainer.cpp
src/core/rootsurfacecontainer.h
src/surface/seatsurfacemanager.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

@glyvut
glyvut force-pushed the Tile branch 2 times, most recently from 6a586e3 to e1fd907 Compare August 20, 2026 13:20
@deepin-bot

deepin-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.9.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1312

@glyvut glyvut changed the title WIP: 分屏动效与四分屏 分屏动效与四分屏 Aug 27, 2026
glyvut added 2 commits August 27, 2026 16:27
Add TopLeft/TopRight/BottomLeft/BottomRight edge tiling modes so
dragging to the corner zones of the left/right edges tiles to a
quarter of the screen. Add edgeQuadrantZoneRatio dconfig to tune
the corner trigger area ratio.

边缘平铺新增四分之一屏(角落象限)模式,光标位于左右边缘上下角落
区域时平铺到屏幕四分之一处,中间区域保持半屏平铺。新增
edgeQuadrantZoneRatio配置项控制角落触发区域比例。

Log: 支持四分之一屏边缘平铺
Influence: 边缘拖拽平铺新增角落象限模式,可平铺到屏幕四分之一区域。
Animate the edge tile preview so it smoothly grows from the dragged
surface's current geometry to the target tile area (250ms), mirroring
KWin's outline effect. Pass the seat to updateEdgeTilePreview to
obtain the source geometry.

边缘平铺预览增加动效:从被拖拽窗口的当前位置平滑动画过渡到目标
平铺区域(250ms),与KWin轮廓效果一致。updateEdgeTilePreview新增
seat参数以获取拖拽窗口的几何位置。

Log: 边缘平铺预览增加动效
Influence: 拖拽边缘预览时显示平滑过渡动画,视觉反馈更清晰。
@glyvut
glyvut marked this pull request as ready for review August 27, 2026 09:02

@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 2 issues

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

## Individual Comments

### Comment 1
<location path="src/core/qml/EdgeTilePreview.qml" line_range="43-44" />
<code_context>
+    }
+
+    onTargetGeometryChanged: {
+        if (visible)
+            applyGeometry(targetGeometry)
+    }
+
</code_context>
<issue_to_address>
**issue (bug_risk):** When the preview is already visible and the detected tile mode changes, changing `targetGeometry` immediately animates from the preview's previous target geometry. The newly assigned `sourceGeometry` is never applied, so the preview does not animate from the dragged window's current geometry as intended.

**Triggers:** When the pointer moves directly between two active edge-tile zones without first hiding the preview.

**Suggested fix:** When `targetGeometry` changes while visible, first apply `sourceGeometry` with animation disabled, then apply the new target with animation enabled, or restart an explicit animation from the current dragged-surface geometry.

```suggestion
        if (visible) {
            animationEnabled = false
            applyGeometry(sourceGeometry)
            animationEnabled = true
            applyGeometry(targetGeometry)
        }
```
</issue_to_address>

### Comment 2
<location path="src/core/rootsurfacecontainer.cpp" line_range="912" />
<code_context>
     auto *cfg = Helper::instance()->config();
     const qreal sideTrigger = cfg ? qreal(cfg->edgeSideTriggerDistance()) : 20.0;
     const qreal topTrigger = cfg ? qreal(cfg->edgeTopTriggerDistance()) : 5.0;
+    const qreal quadRatio = cfg ? qreal(cfg->edgeQuadrantZoneRatio()) : 0.25;
     auto &mrState = container->moveResizeState();
     QuickTile::Mode mode = QuickTile::Mode::None;
</code_context>
<issue_to_address>
**issue (bug_risk):** `quadRatio` is used without validation, so a configured ratio below 0 or above 0.5 makes the quadrant thresholds invalid: negative values disable corner zones, while values above 0.5 make the top zone overlap the bottom zone and effectively eliminate half-screen and bottom-corner detection.

**Triggers:** When the user configures `edgeQuadrantZoneRatio` outside the intended 0–0.5 range.

**Suggested fix:** Clamp the value to a valid range before calculating `quadTop` and `quadBottom`, and constrain or validate the dconfig value accordingly.
</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 on lines +43 to +44
if (visible)
applyGeometry(targetGeometry)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): When the preview is already visible and the detected tile mode changes, changing targetGeometry immediately animates from the preview's previous target geometry. The newly assigned sourceGeometry is never applied, so the preview does not animate from the dragged window's current geometry as intended.

Triggers: When the pointer moves directly between two active edge-tile zones without first hiding the preview.

Suggested fix: When targetGeometry changes while visible, first apply sourceGeometry with animation disabled, then apply the new target with animation enabled, or restart an explicit animation from the current dragged-surface geometry.

Suggested change
if (visible)
applyGeometry(targetGeometry)
if (visible) {
animationEnabled = false
applyGeometry(sourceGeometry)
animationEnabled = true
applyGeometry(targetGeometry)
}

auto *cfg = Helper::instance()->config();
const qreal sideTrigger = cfg ? qreal(cfg->edgeSideTriggerDistance()) : 20.0;
const qreal topTrigger = cfg ? qreal(cfg->edgeTopTriggerDistance()) : 5.0;
const qreal quadRatio = cfg ? qreal(cfg->edgeQuadrantZoneRatio()) : 0.25;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): quadRatio is used without validation, so a configured ratio below 0 or above 0.5 makes the quadrant thresholds invalid: negative values disable corner zones, while values above 0.5 make the top zone overlap the bottom zone and effectively eliminate half-screen and bottom-corner detection.

Triggers: When the user configures edgeQuadrantZoneRatio outside the intended 0–0.5 range.

Suggested fix: Clamp the value to a valid range before calculating quadTop and quadBottom, and constrain or validate the dconfig value accordingly.

@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

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