Skip to content

feat: add border and shadow support for TreeLand windows#393

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Jul 8, 2026
Merged

feat: add border and shadow support for TreeLand windows#393
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

Copy link
Copy Markdown
Contributor

Implement border width/color and shadow radius/offset/color for TreeLand
platform windows. Refactor the personalization window protocol to use
a unified dirty-flag schedule/apply pattern instead of immediate per-
feature calls. This ensures all window decorations are applied together
after surface creation or property changes.

Log: Added window border and shadow customization for TreeLand

Influence:

  1. Test setting border width and color, verify visual appearance
  2. Test setting shadow radius, offset, and color, verify correct
    rendering
  3. Test enabling/disabling no-titlebar mode with borders and shadows
  4. Verify that changing multiple properties at once triggers correct
    apply
  5. Test window resize and surface recreation scenarios for persistence
  6. Verify API backward compatibility: existing radius and blur functions
    still work

feat: 为 Treeland 窗口添加边框和阴影支持

实现边框宽度/颜色和阴影半径/偏移/颜色。重构个性化窗口协议,使用统一的脏
标志调度/应用模式替代旧的即时逐特性调用。确保所有窗口装饰在表面创建或属
性更改后一起应用。

Log: 新增窗口边框和阴影定制功能

Influence:

  1. 测试设置边框宽度和颜色,验证视觉效果
  2. 测试设置阴影半径、偏移和颜色,验证正确渲染
  3. 测试在启用/禁用无标题栏模式下边框和阴影的表现
  4. 验证同时更改多个属性会触发正确的应用
  5. 测试窗口大小变化和表面重建场景的持久性
  6. 验证 API 向后兼容性:原有的圆角和模糊功能仍然正常工作

@18202781743 18202781743 requested review from BLumia and mhduiy July 7, 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.

Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

★ 总体评分:85分

■ 【总体评价】

代码实现了Wayland窗口属性的脏标记延迟批量更新机制,有效解决了Surface重建时的状态丢失与频繁IPC调用问题
逻辑完全正确但因存在大量高度相似的样板代码导致可维护性下降扣15分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

代码中使用了QFlags的默认构造函数将m_initialized和m_dirty初始化为0,按位与、或操作及状态机转换逻辑严密,空指针检查全面(如windowContext()和get(m_window)的返回值均被妥善处理)
潜在问题:无
建议:可在头文件中显式初始化Features m_initialized = {};以提高代码可读性

  • 2.代码质量(一般)✕

DTreeLandPlatformWindowHelper中的setBorderWidth、setBorderColor、setShadowRadius等6个函数内部逻辑完全一致,存在明显的代码重复;DTreeLandPlatformWindowInterface中对应的set函数也存在相同的重复模式
潜在问题:后续新增窗口属性时需要复制粘贴大量相同结构的代码,增加维护成本和出错概率
建议:可以引入模板函数来统一处理属性的设置、脏标记更新与调度,消除重复代码

  • 3.代码性能(高效)✓

引入scheduleApply()通过Qt::QueuedConnection将多次连续的属性修改合并到同一个事件循环中执行,彻底消除了高频触发底层Wayland协议调用的性能瓶颈
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码仅涉及UI窗口属性的状态管理和整型/颜色类型的赋值操作,未涉及任何外部输入解析、命令执行、文件路径拼接或内存分配,不存在安全攻击面

  • 建议:保持当前的编码规范,无需额外安全加固

■ 【改进建议代码示例】

// 在 dtreelandplatformwindowinterface.h 的 DTreeLandPlatformWindowHelper 类 private 区域添加模板辅助函数
private:
    template<typename T>
    void updateFeature(T &member, const T &value, Feature flag) {
        if (member == value)
            return;
        member = value;
        m_initialized |= flag;
        m_dirty |= flag;
        scheduleApply();
    }

// 在 dtreelandplatformwindowinterface.cpp 中简化设置函数实现
void DTreeLandPlatformWindowHelper::setBorderWidth(int borderWidth)
{
    updateFeature(m_borderWidth, borderWidth, Border);
}

void DTreeLandPlatformWindowHelper::setBorderColor(const QColor &borderColor)
{
    updateFeature(m_borderColor, borderColor, Border);
}

void DTreeLandPlatformWindowHelper::setShadowRadius(int shadowRadius)
{
    updateFeature(m_shadowRadius, shadowRadius, Shadow);
}

void DTreeLandPlatformWindowHelper::setShadowOffset(const QPoint &shadowOffset)
{
    updateFeature(m_shadowOffset, shadowOffset, Shadow);
}

void DTreeLandPlatformWindowHelper::setShadowColor(const QColor &shadowColor)
{
    updateFeature(m_shadowColor, shadowColor, Shadow);
}

BLumia
BLumia previously approved these changes Jul 7, 2026
Implement border width/color and shadow radius/offset/color for TreeLand
platform windows. Refactor the personalization window protocol to use
a unified dirty-flag schedule/apply pattern instead of immediate per-
feature calls. This ensures all window decorations are applied together
after surface creation or property changes.

Log: Added window border and shadow customization for TreeLand

Influence:
1. Test setting border width and color, verify visual appearance
2. Test setting shadow radius, offset, and color, verify correct
rendering
3. Test enabling/disabling no-titlebar mode with borders and shadows
4. Verify that changing multiple properties at once triggers correct
apply
5. Test window resize and surface recreation scenarios for persistence
6. Verify API backward compatibility: existing radius and blur functions
still work

feat: 为 Treeland 窗口添加边框和阴影支持

实现边框宽度/颜色和阴影半径/偏移/颜色。重构个性化窗口协议,使用统一的脏
标志调度/应用模式替代旧的即时逐特性调用。确保所有窗口装饰在表面创建或属
性更改后一起应用。

Log: 新增窗口边框和阴影定制功能

Influence:
1. 测试设置边框宽度和颜色,验证视觉效果
2. 测试设置阴影半径、偏移和颜色,验证正确渲染
3. 测试在启用/禁用无标题栏模式下边框和阴影的表现
4. 验证同时更改多个属性会触发正确的应用
5. 测试窗口大小变化和表面重建场景的持久性
6. 验证 API 向后兼容性:原有的圆角和模糊功能仍然正常工作
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@18202781743

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit fb25741 into linuxdeepin:master Jul 8, 2026
26 of 27 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