WM-195: feat: support pointer-constraints protocol - #1267
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm 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 |
Reviewer's GuideAdds Wayland zwp_pointer_constraints_v1 (locked/confined) and zwp_relative_pointer_manager_v1 support to waylib/treeland, wiring them into cursor motion handling and introducing a compositor-side manager to control when constraints can be activated, plus basic protocol tests. Sequence diagram for locked pointer constraint activation and motion handlingsequenceDiagram
participant WPointerConstraintsV1
participant PointerConstraintsManager
participant WSeat
participant WCursor
participant WRelativePointerManagerV1
WPointerConstraintsV1->>WPointerConstraintsV1: create(WServer)
WPointerConstraintsV1->>WPointerConstraintsV1: newConstraint(wlr_pointer_constraint_v1*)
WPointerConstraintsV1->>PointerConstraintsManager: onNewConstraint(wlr_pointer_constraint_v1*)
PointerConstraintsManager->>PointerConstraintsManager: canActivate(wlr_pointer_constraint_v1*)
PointerConstraintsManager->>WSeat: WSeat::fromHandle(qw_seat*)
PointerConstraintsManager->>WCursor: activateConstraint(wlr_pointer_constraint_v1*)
WCursor->>WCursor: setActivePointerConstraint(wlr_pointer_constraint_v1*)
WCursor->>WCursor: on_motion(wlr_pointer_motion_event*)
WCursor->>WCursor: WCursorPrivate::applyPointerConstraint(qw_pointer*, timeMsec, dx, dy, dxUnaccel, dyUnaccel, oldPos)
alt constraint type locked
WCursor->>WRelativePointerManagerV1: sendRelativeMotion(wlr_seat*, timeUsec, dx, dy, dxUnaccel, dyUnaccel)
WCursor->>WCursor: setPosition(qw_pointer*, lockedWarpTarget)
else constraint type confined
WCursor->>WCursor: regionConfineWrapper(region, sx, sy, confinedSx, confinedSy, x2_out, y2_out)
WCursor->>WCursor: setPosition(qw_pointer*, newPos)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
ad20818 to
2d24be7
Compare
1. Add PointerConstraintsManager for activation/deactivation policy 2. Mount WPointerConstraintsV1 and WRelativePointerManagerV1 in Helper 3. Add isInMoveResize accessor and grab exclusion in canActivate 4. Deactivate all constraints on mode switch (lock screen/multitask/view) 5. Add in-tree waylib wrappers and WCursor enforcement path 6. Inline pixman-based regionConfine to avoid wlroots linking dependency 7. Add test_protocol_pointerconstraints test case 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 constraints deactivate on lock screen/multitask/view switch 4. Verify constraints do not activate during drag, popup grab, or move/resize 5. Verify oneshot constraints are destroyed after deactivation feat: 支持 pointer-constraints 协议 1. 新增 PointerConstraintsManager 管理激活/失活策略 2. 在 Helper 中挂载 WPointerConstraintsV1 和 WRelativePointerManagerV1 3. 新增 isInMoveResize 访问器并在 canActivate 中排除 grab/moveResize 4. 模式切换(锁屏/多任务/视图)时全量失活约束 5. 内嵌 waylib 包装器及 WCursor 约束强制路径 6. 内联基于 pixman 的 regionConfine 避免对 wlroots 的链接依赖 7. 新增 test_protocol_pointerconstraints 测试用例 Log: 新增 Wayland 客户端指针锁定和限制功能 Influence: 1. 使用 3D 视角客户端测试锁定指针 2. 使用区域限制客户端测试 confined 指针 3. 验证锁屏/多任务/视图切换时约束失活 4. 验证拖拽/popup grab/move-resize 期间约束不激活 5. 验证 oneshot 约束失活后自动销毁
2d24be7 to
3f24dce
Compare
|
TAG Bot New tag: 0.8.18 |
概述 / Summary
实现
zwp_pointer_constraints_v1(locked/confined)与zwp_relative_pointer_manager_v1协议在 treeland/waylib 中的支持。Implement
zwp_pointer_constraints_v1(locked/confined) andzwp_relative_pointer_manager_v1protocol support in treeland/waylib.改动内容 / Changes
waylib(in-tree vendored):
WPointerConstraintsV1协议包装器(wpointerconstraintsv1.{h,cpp})WRelativePointerManagerV1协议包装器(wrelativepointerv1.{h,cpp})WCursorPrivate::on_motion/on_motion_absolute插入约束强制路径(applyPointerConstraint):sendRelativeMotion发送相对增量(时间戳微秒),隐藏光标并每次运动 warp 回锚点防累积偏移pointer_state.sx/sy为锚点 + 内联regionConfineWrapper(pixman 实现)钳制到约束 regionregionConfine替代wlr_region_confine,避免 wlroots 链接依赖treeland:
Helper::init挂载WPointerConstraintsV1与WRelativePointerManagerV1PointerConstraintsManager管理激活/失活策略:canActivate检查模式为 Normal、无 drag、无 pointer grab(wlr_seat_pointer_has_grab)、无 move/resize(isInMoveResize)、持 pointer focusonSeatGrabChanged在 grab_begin 只失活不重激活,grab_end 后才重新评估set_region变化时重新评估Helper::isInMoveResize(WSeat*)访问器deactivateAll()全量失活test_protocol_pointerconstraints测试用例关联 / Related
测试 / Testing
本地全量编译验证通过(V25 / GCC 12.3 / Qt 6.8 /
-Wall -Wextra -Werror/--as-needed/ ninja-j16):test_protocol_pointerconstraints构建并通过(12/12 tests passed).deb已知限制 / Known Limitations
surfaceSizeRatio ≠ 1时 confined 钳制假设 surface-local 与 output-layout delta 同为逻辑坐标pointer_state.events.focus_changecursor_hint运行中不实时更新以上三项作为后续 TODO 跟踪,不构成本轮阻断。
Summary by Sourcery
Add compositor-side support for Wayland pointer constraints and relative pointer protocols, including cursor behavior changes and seat-level activation management.
New Features:
Enhancements:
Tests: