Skip to content

fix(dock): deduct column spacing from center space in non-fashion mode - #1738

Open
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/3a7ad828f0bc
Open

fix(dock): deduct column spacing from center space in non-fashion mode#1738
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/3a7ad828f0bc

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Root Cause Analysis

In non-fashion mode (efficient mode), dockRawCenterSpace calculates the maximum width of the center app icon area as Screen.width - dockLeftPart.implicitWidth - dockRightPart.implicitWidth without deducting gridLayout.columnSpacing. When many apps fill the center area to its maximum width, the right edge extends ~10-20px (1-2 column spacings) into the tray area (dockRightPart), causing slight visual overlap.

Key evidence:

  • Fashion mode already deducts columnSpacing * 2 in the same property, but the non-fashion branch was never adjusted
  • OverflowContainer.qml's ListView lacks clip: true, allowing visual overflow even when layout width is constrained

Fix

  1. In dockRawCenterSpace (main.qml), add an else if branch for non-fashion mode that deducts columnSpacing (1x when dockLeftPart is hidden, 2x when visible) from the space calculation
  2. Add clip: true to OverflowContainer.qml's ListView as a visual safety net

Change Safety Assessment

  • Risk level: Low — only adjusts a width calculation formula and adds a clip property; no structural layout changes
  • Fashion mode: Unaffected (existing deduction logic untouched)
  • Regression risk: Center area max width shrinks ~10-20px; at most 1-2 extra icons may be compressed when apps are numerous — no functional impact

Business Impact

  • Affected module: Dock layout (non-fashion/efficient mode)
  • User scenario: Opening many apps causing icon compression in the taskbar
  • Expected behavior: App icons and tray icons no longer slightly overlap

Verification Suggestions

  • Non-fashion mode, dock at bottom: open many apps to trigger compression, verify no overlap between app icons and tray area
  • Repeat for dock at top/left/right positions
  • Fashion mode: verify no regression

根因分析

非时尚模式(高效模式)下,dockRawCenterSpace 计算中间应用图标区域最大宽度时未扣除 gridLayout.columnSpacing。当应用图标撑满该最大宽度时,右边缘侵入托盘区域约 10-20px(1-2 个列间距),产生轻微重叠。

关键证据:

  • 时尚模式已在同一属性中扣除 columnSpacing * 2,但非时尚模式分支从未调整
  • OverflowContainer.qmlListView 缺少 clip: true,即使布局宽度被约束仍可视觉溢出

修复方案

  1. dockRawCenterSpacemain.qml)中为非时尚模式添加 else if 分支,扣除 columnSpacingdockLeftPart 不可见时 1x,可见时 2x)
  2. OverflowContainer.qmlListView 添加 clip: true 作为视觉兜底

改动安全评估

  • 风险等级:低 — 仅调整宽度计算公式和添加 clip 属性,不改变布局结构
  • 时尚模式:不受影响(现有扣除逻辑未改动)
  • 回归风险:中间区域最大宽度减小约 10-20px,应用图标极多时可能多挤压 1-2 个图标,无功能异常

业务影响范围

  • 受影响模块:任务栏布局(非时尚/高效模式)
  • 用户场景:打开大量应用使任务栏图标产生挤压
  • 预期行为:应用图标与托盘图标区域不再轻微重叠

验证建议

  • 非时尚模式、任务栏位置下:打开超多应用使图标挤压,验证应用图标与托盘图标区域不重叠
  • 任务栏位置上/左/右重复验证
  • 时尚模式下验证无回归

Summary by Sourcery

Prevent dock app icons from overlapping the tray area in non-fashion mode.

Bug Fixes:

  • Prevent app icons in non-fashion dock mode from overlapping the tray area by accounting for column spacing in the available center width.
  • Clip dock list contents to their allocated bounds to prevent visual overflow.

In non-fashion mode, dockRawCenterSpace did not account for GridLayout
column spacing, causing the center app icon area to extend ~10-20px
into the tray area when many apps are open, producing slight overlap.

Deduct columnSpacing (1x when dockLeftPart is hidden, 2x when visible)
from the maximum center width calculation. Also add clip: true to
OverflowContainer's ListView as a visual safety net.

PMS: BUG-368011
Log:
Influence: 非时尚模式下应用图标与托盘图标区域不再轻微重叠

@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.

Sorry @mhduiy, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 hours and 44 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy

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 Sep 14, 2026

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

Reviewer's Guide

The dock now reserves the appropriate column spacing in non-fashion mode and clips overflow content, preventing densely populated app icons from visually overlapping the tray while leaving fashion-mode behavior unchanged.

Flow diagram for dock center-space calculation

flowchart TD
    A[dockRawCenterSpace] --> B{fashionDock.visible}
    B -->|yes| C[Deduct 2 column spacings and floating margins]
    B -->|no| D{gridLayout exists}
    D -->|yes| E[Deduct one column spacing]
    E --> F{dockLeftPart.visible}
    F -->|yes| G[Deduct a second column spacing]
    F -->|no| H[Return non-negative center space]
    G --> H
    D -->|no| H
    C --> H
Loading

File-Level Changes

Change Details Files
Correct the non-fashion dock center-space calculation to reserve grid column spacing before the tray area.
  • Subtract one rounded column spacing unit for the standard layout.
  • Subtract a second spacing unit when the left dock section is visible.
  • Preserve the existing fashion-mode calculation and clamp the resulting space at zero.
panels/dock/package/main.qml
Prevent overflowed app content from rendering beyond its allocated dock container.
  • Enable clipping on the overflow list view.
panels/dock/OverflowContainer.qml

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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码变更较小且质量高,修复了非时尚模式下中心区域空间计算未扣除GridLayout列间距的问题,同时为ListView添加了clip属性防止内容溢出。语法正确,逻辑清晰,注释完整,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

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