Skip to content

fix: Let notification center use Wayland exclusive zones#1630

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/notification-wayland-exclusive-zone
Jun 11, 2026
Merged

fix: Let notification center use Wayland exclusive zones#1630
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/notification-wayland-exclusive-zone

Conversation

@yixinshark

Copy link
Copy Markdown
Contributor

Summary

  • Use zero layer-shell margins for the notification center on Wayland.
  • Set the notification center exclusionZone to 0 on Wayland and keep non-Wayland behavior unchanged.
  • Preserve the existing windowMargin() path outside Wayland.

Test Plan

  • cmake --build /home/uos/dde-shell/dde-shell-master/build -j2
  • Verified notificationcenterpanel and dde-shell build targets complete successfully on the remote test machine.

@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 @yixinshark, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@yixinshark yixinshark force-pushed the fix/notification-wayland-exclusive-zone branch 2 times, most recently from f74a338 to 2ca060a Compare June 11, 2026 07:41
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

这段代码是通知中心面板的主界面实现,我来对它进行详细的审查:

语法逻辑

  1. 新增的 layerShellMargin 函数逻辑正确,它根据平台类型返回不同的边距值:

    • 在 Wayland 平台上返回 0
    • 其他平台调用 windowMargin 函数计算边距
  2. 代码修改将原来的 windowMargin 调用替换为 layerShellMargin,并修改了 exclusionZone 的值:

    • 在 Wayland 平台上设为 0
    • 其他平台保持为 -1

代码质量

  1. 优点:

    • 代码结构清晰,函数命名恰当
    • 使用了统一的平台检测方式 Qt.platform.pluginName
    • 逻辑分离良好,将平台相关逻辑封装在单独函数中
  2. 可改进点:

    • 可以考虑在 layerShellMargin 函数中添加注释,说明其用途和参数含义
    • 可以考虑将 windowMargin 函数也移到同一区域,保持相关代码的集中性

代码性能

  1. 性能表现良好:

    • 平台检测只在初始化时进行一次,不会影响运行时性能
    • 函数调用简单,没有复杂计算
  2. 可改进点:

    • 如果 windowMargin 函数被频繁调用,可以考虑添加缓存机制

代码安全

  1. 安全性良好:

    • 平台检测使用 Qt 提供的标准接口,避免了硬编码平台名称
    • 边距计算逻辑清晰,不会导致越界问题
  2. 可改进点:

    • 可以考虑添加平台名称的有效性检查,防止未来 Qt 框架新增平台类型时的潜在问题

具体改进建议

function layerShellMargin(position) {
    // 根据平台返回不同的边距值
    // position: 0=顶部, 1=右侧, 2=底部
    if (Qt.platform.pluginName === "wayland")
        return 0

    return windowMargin(position)
}

或者,如果这是一个频繁调用的函数,可以考虑添加缓存:

// 在组件顶部添加
readonly property var platformMarginCache: ({})

function layerShellMargin(position) {
    // 使用缓存避免重复计算
    if (platformMarginCache[position] !== undefined)
        return platformMarginCache[position]
        
    if (Qt.platform.pluginName === "wayland") {
        platformMarginCache[position] = 0
        return 0
    }

    platformMarginCache[position] = windowMargin(position)
    return platformMarginCache[position]
}

总体而言,这段代码的质量较好,修改合理且安全。主要改进空间在于代码可读性和文档完善方面。

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

The Wayland notification center panel should rely on compositor-reserved exclusive zones rather than adding Dock margins itself.
- Add a layer-shell margin helper that returns zero on Wayland and preserves windowMargin() elsewhere.
- Set exclusionZone to 0 on Wayland and keep -1 for non-Wayland platforms.
- Avoid extra Dock spacing on Wayland without changing X11 behavior.

Wayland 通知中心面板应依赖合成器预留的独占区域,而不是自身继续叠加 Dock 边距。
- 增加 layer-shell 边距辅助函数,在 Wayland 下返回 0,其他平台继续使用 windowMargin()。
- Wayland 下将 exclusionZone 设置为 0,非 Wayland 平台保持 -1。
- 避免 Wayland 下出现额外 Dock 间距,同时不改变 X11 行为。

Log: Let notification center use Wayland exclusive zones
Pms: BUG-365785
@yixinshark yixinshark force-pushed the fix/notification-wayland-exclusive-zone branch from 2ca060a to ce3ad8f Compare June 11, 2026 08:08
@yixinshark

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit ce870a7 into linuxdeepin:master Jun 11, 2026
7 of 9 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