Skip to content

fix: Avoid manual dock margins on Wayland#267

Merged
yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix-clipboard-wayland-exclusive-zone
Jun 11, 2026
Merged

fix: Avoid manual dock margins on Wayland#267
yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix-clipboard-wayland-exclusive-zone

Conversation

@yixinshark

Copy link
Copy Markdown
Contributor

Summary

  • Let Wayland layer-shell placement rely on compositor exclusive-zone avoidance.
  • Skip manual Dock margin additions only on Wayland while preserving the X11 path.
  • Set the clipboard layer-shell exclusive zone to 0.

Test Plan

  • cmake --build build -j2
  • Built on the remote Wayland test machine.
  • Verified the clipboard panel displays with expected spacing on Treeland.

@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

Wayland layer-shell surfaces should let the compositor account for Dock exclusive zones instead of converting Dock geometry in the client.
- Skip Dock-size margin adjustments on Wayland while keeping the existing X11 margin path.
- Set the layer-shell exclusive zone to 0 so Treeland can configure the surface against reserved Dock space.
- Keep X11 behavior unchanged because the existing emulation already uses exclusive zone 0 and still applies manual Dock margins.

Wayland 的 layer-shell 窗口应交由合成器根据 Dock 独占区域避让,而不是在客户端继续换算 Dock 几何。
- Wayland 下跳过 Dock 尺寸相关的边距叠加,保留现有 X11 边距处理路径。
- 将 layer-shell exclusive zone 设置为 0,让 Treeland 根据 Dock 预留空间配置窗口。
- X11 行为保持不变,因为现有模拟实现已经使用 exclusive zone 0,并仍会应用手动 Dock 边距。

Log: Avoid manual dock margins on Wayland
Pms: BUG-294811
Change-Id: I209d3044dbbef22afe010a99868cc1ce52b8bc81
@yixinshark yixinshark force-pushed the fix-clipboard-wayland-exclusive-zone branch from 183c159 to 01337d3 Compare June 11, 2026 07:40
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

这段代码涉及对剪贴板主窗口的修改,主要关注了Wayland和X11平台下的差异处理。我来分析一下这些变更:

  1. geometryChanged()函数中,添加了对m_isWayland的检查:
if (!m_isWayland && m_daemonDockInter->hideState() != 2 && (window() && window()->screen()->geometry().contains(dockGeometry))) {

改进建议:

  • 这个改动是合理的,确保只在非Wayland环境下执行特定的几何计算逻辑。
  • 建议添加注释说明为什么Wayland环境下需要特殊处理,因为Wayland的窗口管理机制与X11不同。
  1. onFrontendWindowRectChanged函数中,同样添加了m_isWayland检查:
if (!m_isWayland && dockGeometry.width() > 0 && dockGeometry.height() > 0) {

改进建议:

  • 同样是合理的平台特定处理。
  • 建议将Wayland和X11的不同处理逻辑封装到单独的函数中,提高代码可读性。
  1. initUI()函数中,修改了LayerShell的设置:
// 旧代码
layerShellWnd->setExclusiveZone(m_isWayland ? -1 : 0);

// 新代码
layerShellWnd->setExclusiveZone(0);

改进建议:

  • 这个改动简化了排他区域设置,统一使用0值。
  • 建议保留更详细的注释,解释为什么选择0作为排他区域的值,以及它对Wayland和X11的具体影响。
  • 考虑添加日志记录,以便在调试时了解窗口在不同平台下的行为。

总体建议:

  1. 考虑将平台特定的逻辑封装到单独的函数中,比如handleX11Geometry()handleWaylandGeometry(),以提高代码的组织性。
  2. 添加适当的注释,解释为什么Wayland和X11需要不同的处理方式,因为这两个窗口系统的底层机制差异很大。
  3. 考虑添加单元测试,特别是针对不同平台下的窗口行为测试。
  4. 可以考虑使用编译器指令或宏来明确标记平台特定的代码块,例如#ifdef WAYLAND等,使平台差异更加明显。

这些修改看起来是为了更好地支持Wayland环境,同时保持与X11的兼容性。整体方向是正确的,但可以通过更好的代码组织和注释来提高可维护性。

@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

@yixinshark yixinshark merged commit 1193cee into linuxdeepin:master Jun 11, 2026
17 of 19 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