Skip to content

WM-195: feat: support pointer-constraints protocol - #653

Closed
deepin-wm wants to merge 1 commit into
vioken:masterfrom
deepin-wm:agent/bot/a6fc6c7e-waylib
Closed

WM-195: feat: support pointer-constraints protocol#653
deepin-wm wants to merge 1 commit into
vioken:masterfrom
deepin-wm:agent/bot/a6fc6c7e-waylib

Conversation

@deepin-wm

Copy link
Copy Markdown

概述 / Summary

在 waylib 中实现 zwp_pointer_constraints_v1(locked/confined)与 zwp_relative_pointer_manager_v1 协议支持。

Implement zwp_pointer_constraints_v1 (locked/confined) and zwp_relative_pointer_manager_v1 protocol support in waylib.

改动内容 / Changes

  • 新增 WPointerConstraintsV1 协议包装器(wpointerconstraintsv1.{h,cpp}),提供 createconstraintForSurfacenewConstraint 信号
  • 新增 WRelativePointerManagerV1 协议包装器(wrelativepointerv1.{h,cpp}),提供 sendRelativeMotion
  • WCursorPrivate::on_motion/on_motion_absolute 插入约束强制路径(applyPointerConstraint):
    • Locked:通过 sendRelativeMotion 发送相对增量(时间戳微秒 time_msec*1000),隐藏光标并每次运动 warp 回锚点防累积偏移
    • Confined:用 pointer_state.sx/sy 为锚点 + 内联 regionConfineWrapper(pixman 实现)钳制到约束 region
  • 内联基于 pixman 的 regionConfine 替代 wlr_region_confine,避免 wlroots util 链接依赖
  • WCursor 上新增 setActivePointerConstraint/activePointerConstraint API
  • CMakeLists.txt 中注册新增文件

关联 / Related

已知限制 / Known Limitations

  1. surfaceSizeRatio ≠ 1 时 confined 钳制假设 surface-local 与 output-layout delta 同为逻辑坐标
  2. 无 grab 的 pointer focus 漂移未接 pointer_state.events.focus_change
  3. locked cursor_hint 运行中不实时更新

以上三项作为后续 TODO 跟踪。

1. Add WPointerConstraintsV1 wrapper for zwp_pointer_constraints_v1
2. Add WRelativePointerManagerV1 wrapper for zwp_relative_pointer_manager_v1
3. Implement cursor constraint enforcement in WCursorPrivate
4. Locked: send relative motion via sendRelativeMotion and warp back to anchor
5. Confined: clamp cursor to constraint region using inline pixman regionConfine
6. Inline pixman-based regionConfine to avoid wlroots util linking dependency
7. Add setActivePointerConstraint/activePointerConstraint API on WCursor

Log: Added pointer lock and confinement support for wayland clients

Influence:
1. Test locked pointer with a 3D mouselook client
2. Test confined pointer with a region-limited client
3. Verify cursor warps back to anchor during locked constraint
4. Verify confined cursor stays within the constraint region
5. Verify constraint activation/deactivation lifecycle

feat: 支持 pointer-constraints 协议

1. 新增 WPointerConstraintsV1 包装 zwp_pointer_constraints_v1
2. 新增 WRelativePointerManagerV1 包装 zwp_relative_pointer_manager_v1
3. 在 WCursorPrivate 中实现光标约束强制
4. Locked: 通过 sendRelativeMotion 发送相对增量并回 warp 锚点
5. Confined: 用内联 pixman regionConfine 钳制到约束 region
6. 内联基于 pixman 的 regionConfine 避免 wlroots util 链接依赖
7. 在 WCursor 上新增 setActivePointerConstraint/activePointerConstraint 接口

Log: 新增 Wayland 客户端指针锁定和限制功能

Influence:
1. 使用 3D 视角客户端测试锁定指针
2. 使用区域限制客户端测试 confined 指针
3. 验证锁定约束期间光标回 warp 到锚点
4. 验证 confined 光标保持在约束区域内
5. 验证约束激活/失活生命周期
@deepin-wm
deepin-wm force-pushed the agent/bot/a6fc6c7e-waylib branch from f537fd1 to b20cd6e Compare August 11, 2026 16:35
@deepin-wm

Copy link
Copy Markdown
Author

不需要独立的 waylib PR,waylib 改动已包含在 treeland PR #1267 的内嵌 waylib 中。关闭本 PR。

@deepin-wm deepin-wm closed this Aug 13, 2026
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.

2 participants