feat: support pointer-constraints protocol - #1294
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 GuideImplements Wayland zwp_pointer_constraints_v1 and zwp_relative_pointer_manager_v1 support in waylib, adds a compositor-side PointerConstraintsManager in treeland to control activation based on focus/grabs/modes, wires this into WCursor for locked/confined enforcement, and introduces a basic protocol test. Sequence diagram for pointer constraint activation and enforcementsequenceDiagram
participant Client
participant WPointerConstraintsV1
participant PointerConstraintsManager
participant WSeat
participant WCursor
participant WCursorPrivate
participant WRelativePointerManagerV1
Client->>WPointerConstraintsV1: newConstraint (wlr_pointer_constraint_v1)
WPointerConstraintsV1->>PointerConstraintsManager: newConstraint (constraint)
PointerConstraintsManager->>PointerConstraintsManager: ensureSeatTracked(seat)
PointerConstraintsManager->>PointerConstraintsManager: activateConstraint(constraint)
PointerConstraintsManager->>WSeat: fromHandle(seat)
WSeat-->>PointerConstraintsManager: cursor()
PointerConstraintsManager->>WCursor: setActivePointerConstraint(constraint)
PointerConstraintsManager->>constraint: wlr_pointer_constraint_v1_send_activated
WCursorPrivate->>WCursorPrivate: on_motion(event)
WCursorPrivate->>WCursorPrivate: applyPointerConstraint(device, timeMsec, dx, dy,...)
alt [activeConstraint type == WLR_POINTER_CONSTRAINT_V1_LOCKED]
WCursorPrivate->>WRelativePointerManagerV1: sendRelativeMotion(seat, timeUsec, dx, dy,...)
WCursorPrivate->>WCursor: setPosition(device, lockedWarpTarget)
else [activeConstraint type == WLR_POINTER_CONSTRAINT_V1_CONFINED]
WCursorPrivate->>WCursor: setPosition(device, confined position)
WCursorPrivate->>WCursorPrivate: processCursorMotion(device, timeMsec)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Implement zwp_pointer_constraints_v1 (locked/confined pointer) and zwp_relative_pointer_manager_v1 in treeland and waylib. waylib protocol wrappers: - WPointerConstraintsV1 creates the wlroots global and forwards new_constraint to the compositor policy layer - WRelativePointerManagerV1 forwards relative pointer motion, needed by locked pointers - WCursor/WCursorPrivate enforce the active constraint (locked relative motion, confined region clamping) treeland integration: - PointerConstraintsManager activates/deactivates constraints with per-object WListenerOwner and focus re-evaluation - Helper mounts the managers and drops active constraints when leaving Normal mode; isInMoveResize() excludes Qt-level move/resize Tests: test_protocol_pointerconstraints covers the protocol paths. 在 treeland 与 waylib 中实现 zwp_pointer_constraints_v1 (锁定/限制指针)与 zwp_relative_pointer_manager_v1 协议支持。 waylib 协议包装器: - WPointerConstraintsV1 创建 wlroots global,将 new_constraint 转发给 合成器策略层 - WRelativePointerManagerV1 转发相对指针运动,供锁定指针使用 - WCursor/WCursorPrivate 生效活动约束(锁定相对运动、限制区域裁剪) treeland 集成: - PointerConstraintsManager 以 per-object WListenerOwner 与焦点重评估 激活/失活约束 - Helper 挂载管理器,离开 Normal 模式时清除活动约束; isInMoveResize() 排除 Qt 层移动/缩放 测试:test_protocol_pointerconstraints 覆盖协议路径。 Log: 实现 pointer-constraints 与 relative-pointer 协议 Influence: 支持客户端锁定/限制指针及相对指针运动,补齐 wayland 协议能力。
09331a8 to
6583bb9
Compare
|
这个有用,啥时候能合并进去,firefox闪退就是因为缺少这个协议。 |
游戏有用,大概周五合,无关 firefox 闪退大概和之前的qwlroots移除的pr有关系,@Groveer 在修 |
|
按照维护者指示关闭本 PR:pointer-constraints 的实现改为在 #1303 上评估改动是否合理(仅评审,不修改代码),本 PR 不再继续推进。 |
概述
在 treeland/waylib 中实现 Wayland pointer-constraints 协议,支持锁定指针(locked)与限制指针(confined),以及相对指针管理(relative pointer)。
改动内容
waylib 协议层(waylib/src/server/protocols/)
WPointerConstraintsV1:创建 wlroots global,将new_constraint转发给合成器策略层WRelativePointerManagerV1:转发相对指针运动,供锁定指针使用WCursor/WCursorPrivate:生效活动约束(锁定时转发相对运动、限制时按区域裁剪)treeland 集成(src/seat/)
PointerConstraintsManager:以 per-objectWListenerOwner与焦点重评估激活/失活约束Helper:挂载管理器;离开 Normal 模式(锁屏 / 多任务视图 / 窗口切换)时清除活动约束;新增isInMoveResize()以排除 Qt 层移动/缩放测试
tests/test_protocol_pointerconstraints覆盖协议路径编译与测试
origin/master8e41511b7-Wall -Wextra -Werror),ctest17/17 通过(含test_protocol_pointerconstraints)关联
Summary by Sourcery
Implement pointer locking and confinement support across waylib and treeland with lifecycle-aware activation and relative motion delivery.
New Features:
Enhancements:
Build:
Tests: