Skip to content

docs: fix launcheritem dock size calculation - #803

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:task-395113
Sep 2, 2026
Merged

docs: fix launcheritem dock size calculation#803
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:task-395113

Conversation

@wjyrich

@wjyrich wjyrich commented Sep 2, 2026

Copy link
Copy Markdown
Contributor
  1. The dock exclusion zone calculation incorrectly included full dock thickness
  2. Changed to use actual reserved layer-shell zone when TreeLand is active
  3. Added dockReservedZone property to read layer shell exclusion zone
  4. Dock spacing remains constant while thickness contribution is bounded by reserved zone

Log: Fixed dock reserved space calculation for launcher panel

Influence:

  1. Test launcher popup on dock positions (top, bottom, left, right)
  2. Verify TreeLand system tray overlay behavior
  3. Confirm minimized window icon alignment unaffected
  4. Test other desktop environments without layer-shell support
  5. Check dock icon scaling with ultra-wide displays

docs: 修复启动器面板 dock 尺寸计算问题

  1. 修复了 dock 排除区域计算中错误包含完整 dock 厚度的问题
  2. 在 TreeLand 启用时,改用实际预留的 layer-shell 区域
  3. 新增 dockReservedZone 属性,用于读取 layer shell 的排除区域
  4. Dock 间距保持恒定,而厚度贡献受预留区域约束

Log: 修复启动器面板的 dock 预留空间计算

Influence:

  1. 测试启动器弹窗在 dock 不同位置(上、下、左、右)的显示效果
  2. 验证 TreeLand 系统托盘叠加层行为
  3. 确认最小化窗口图标对齐不受影响
  4. 测试其他不支持 layer-shell 的桌面环境
  5. 检查超宽屏显示器下 dock 图标缩放效果

PMS: TASK-395113

Summary by Sourcery

Fix launcher panel sizing around docks by calculating exclusion space from the actual reserved dock zone.

Bug Fixes:

  • Correct the launcher panel dock exclusion calculation so reserved layer-shell space is used when available and dock thickness is not double-counted.

Enhancements:

  • Preserve constant dock spacing while bounding the dock thickness contribution to the actual reserved zone, including support for environments without layer-shell support.

1. The dock exclusion zone calculation incorrectly included full dock
thickness
2. Changed to use actual reserved layer-shell zone when TreeLand is
active
3. Added dockReservedZone property to read layer shell exclusion zone
4. Dock spacing remains constant while thickness contribution is bounded
by reserved zone

Log: Fixed dock reserved space calculation for launcher panel

Influence:
1. Test launcher popup on dock positions (top, bottom, left, right)
2. Verify TreeLand system tray overlay behavior
3. Confirm minimized window icon alignment unaffected
4. Test other desktop environments without layer-shell support
5. Check dock icon scaling with ultra-wide displays

docs: 修复启动器面板 dock 尺寸计算问题

1. 修复了 dock 排除区域计算中错误包含完整 dock 厚度的问题
2. 在 TreeLand 启用时,改用实际预留的 layer-shell 区域
3. 新增 dockReservedZone 属性,用于读取 layer shell 的排除区域
4. Dock 间距保持恒定,而厚度贡献受预留区域约束

Log: 修复启动器面板的 dock 预留空间计算

Influence:
1. 测试启动器弹窗在 dock 不同位置(上、下、左、右)的显示效果
2. 验证 TreeLand 系统托盘叠加层行为
3. 确认最小化窗口图标对齐不受影响
4. 测试其他不支持 layer-shell 的桌面环境
5. 检查超宽屏显示器下 dock 图标缩放效果

PMS: TASK-395113
@sourcery-ai

sourcery-ai Bot commented Sep 2, 2026

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

Reviewer's Guide

Updates launcher dock exclusion calculation to use the actual TreeLand layer-shell reserved zone, preventing full dock thickness from being double-counted while retaining consistent spacing and icon alignment.

Flow diagram for launcher dock exclusion calculation

flowchart TD
    A[Determine dock orientation] --> B[Read dockThickness]
    B --> C{TreeLand active?}
    C -->|Yes| D[Read DLayerShellWindow.exclusionZone]
    C -->|No| E[Use dockReservedZone = 0]
    D --> F[Calculate dockExclusion]
    E --> F
    F --> G["dockSpacing + max(0, dockThickness - dockReservedZone)"]
    G --> H[Calculate iconAlignOffset]
Loading

File-Level Changes

Change Details Files
Correct dock exclusion sizing for launcher items by separating fixed spacing from the dock thickness actually contributing beyond the reserved layer-shell area.
  • Added a TreeLand-specific property that reads the panel’s layer-shell exclusion zone.
  • Bound the thickness contribution to non-negative space remaining after the reserved zone.
  • Kept dock spacing as a constant contribution and preserved existing icon alignment logic.
shell-launcher-applet/package/launcheritem.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

@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 reviewed your changes and they look great!


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.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码修复了 dock 排除区域计算中重复计算预留空间的问题,逻辑正确,边界处理完善,无安全漏洞。仅有少量代码质量改进建议。
项目名称 linuxdeepin/dde-launchpad
PR 地址 #803
分析模式 全量分析(GitHub PR)

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰,边界处理完善 ✓

评分: 25/25

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

代码逻辑分析:

本次修改修复了 dockExclusion 属性的计算逻辑:

  • 修改前: dockExclusion = dockThickness + dockSpacing,直接将 dock 厚度与间距相加,未考虑 layer-shell 已预留的排除区域,在 TreeLand 环境下会导致重复计算。
  • 修改后: 引入 dockReservedZone 属性,在 TreeLand 环境下读取 layer-shell 的 exclusionZone,并使用 Math.max(0, dockThickness - dockReservedZone) 计算未被预留的额外排除空间。

边界条件验证:

  1. 非 TreeLand 环境:dockReservedZone=0dockExclusion=dockSpacing+dockThickness,与原逻辑一致 ✓
  2. TreeLand 完全预留:dockReservedZone=dockThicknessdockExclusion=dockSpacing,仅保留间距 ✓
  3. TreeLand 部分预留:dockReservedZone<dockThicknessdockExclusion=dockSpacing+(dockThickness-dockReservedZone)
  4. TreeLand 超额预留:dockReservedZone>dockThicknessMath.max(0,...) 确保不为负数 ✓

2. 代码质量 ✅

评价: 代码结构清晰,可读性好 ✓

评分: 23/25

潜在问题:

  1. shell-launcher-applet/package/launcheritem.qml 第 293 行:新增的 dockReservedZone 属性缺少注释说明。该属性用于读取 layer-shell 的排除区域,建议添加简要注释说明其含义和用途。(-2分)
  2. shell-launcher-applet/package/launcheritem.qml 第 294 行:空行存在尾随空格(trailing whitespace),建议删除。

建议:

  1. 建议为 dockReservedZone 属性添加注释,说明 layer-shell exclusionZone 的含义
  2. 建议删除空行的尾随空格

3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✓

评分: 20/20

潜在问题:
✅ 未发现性能问题

性能分析:

  • 新增的属性绑定仅涉及简单的算术运算和三元判断,复杂度为 O(1)
  • DesktopIntegration.isTreeLand() 为布尔判断,开销极小
  • Math.max(0, ...) 为内置函数,无性能开销
  • QML 属性绑定按需重新计算,不会造成不必要的性能损耗

4. 代码安全 🔒

评价: 存在0个安全漏洞 ✓

评分: 30/30

🔐 发现 0 个安全漏洞

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

漏洞对比统计: 新增漏洞 0 个,减少漏洞 0 个,持平 0 个

安全分析:

  • 本次修改为 QML UI 布局计算逻辑,不涉及用户输入处理
  • 无外部数据输入,无注入风险
  • 无敏感信息泄露
  • 无权限操作
  • 属性绑定均为内部计算,无安全边界问题

💡 改进建议代码示例

建议 1:为 dockReservedZone 添加注释

// dock 在 layer-shell 中已预留的排除区域,仅 TreeLand 环境下有效
readonly property int dockReservedZone: DesktopIntegration.isTreeLand() ? Panel.rootObject.DLayerShellWindow.exclusionZone : 0

readonly property int dockExclusion: DesktopIntegration.dockSpacing
                                      + Math.max(0, dockThickness - dockReservedZone)

建议 2:删除尾随空格

// 修改前(第 294 行有尾随空格):
        readonly property int dockReservedZone: DesktopIntegration.isTreeLand() ? Panel.rootObject.DLayerShellWindow.exclusionZone : 0
        
// 修改后(空行无尾随空格):
        readonly property int dockReservedZone: DesktopIntegration.isTreeLand() ? Panel.rootObject.DLayerShellWindow.exclusionZone : 0

📋 评分汇总

维度 评分 满分 结果
语法逻辑 25 25 ✅ 通过
代码质量 23 25 ✅ 通过
代码性能 20 20 ✅ 通过
代码安全 30 30 ✅ 通过
总分 98 100 ✅ 通过

📝 审查结论

本次 PR 修复了 launcheritem.qml 中 dock 排除区域计算的问题。在 TreeLand 环境下,原代码未考虑 layer-shell 已预留的排除区域,导致 dock 排除空间被重复计算。修复方案引入 dockReservedZone 属性读取实际预留区域,并通过 Math.max(0, dockThickness - dockReservedZone) 计算额外需要的排除空间,逻辑正确,边界处理完善。

代码变更范围小(4 行新增,1 行删除),风险可控。OCR 专业代码审查工具未发现任何问题。建议合并前处理尾随空格和补充属性注释。


本报告由 AI 代码审查工具自动生成
扫描时间:2026-09-02 16:28:00

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, wjyrich

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

@wjyrich

wjyrich commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit c98fc9b into linuxdeepin:master Sep 2, 2026
6 checks passed
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