fix: Let notification center use Wayland exclusive zones#1630
Conversation
There was a problem hiding this comment.
Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
f74a338 to
2ca060a
Compare
deepin pr auto review这段代码是通知中心面板的主界面实现,我来对它进行详细的审查: 语法逻辑
代码质量
代码性能
代码安全
具体改进建议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]
}总体而言,这段代码的质量较好,修改合理且安全。主要改进空间在于代码可读性和文档完善方面。 |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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
2ca060a to
ce3ad8f
Compare
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Summary
Test Plan