feat: implement multi-seat support#758
Conversation
There was a problem hiding this comment.
Sorry @Dami-star, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Pull request overview
This PR introduces multi-seat support across Waylib and Treeland, adding a seat manager + rule-based device assignment and updating focus/move-resize/event routing to be seat-aware.
Changes:
- Add
WSeatManagerto create/manage seats and apply regex rules for auto-assigning input devices. - Extend
WSeat/WInputDevicewith fallback/output tracking and device-identification helpers (name/path) used by matching. - Refactor Treeland surface focus and move/resize handling to maintain per-seat state via
SeatSurfaceContainerand per-seat event processing.
中文概述:
该 PR 为 Waylib 与 Treeland 引入多 seat 支持,新增 seat 管理与基于规则的设备分配,并将焦点、移动/缩放与事件处理改造成按 seat 维度管理。
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
waylib/src/server/protocols/winputmethodhelper.cpp |
Gate text-input enter by seat to avoid cross-seat focus delivery. |
waylib/src/server/kernel/wseatmanager.h |
New WSeatManager API for seat/config/rules. |
waylib/src/server/kernel/wseatmanager.cpp |
WSeatManager implementation (seat lifecycle, rule matching, config I/O). |
waylib/src/server/kernel/wseat.h |
Add fallback/output properties and device rule matching hooks. |
waylib/src/server/kernel/wseat.cpp |
Implement fallback/outputs/matching; harden handle null-paths. |
waylib/src/server/kernel/winputdevice.h |
Expose name() and devicePath() for rule matching. |
waylib/src/server/kernel/winputdevice.cpp |
Implement name() and devicePath() (libinput/udev + /proc fallback). |
waylib/src/server/kernel/wcursor.cpp |
Route pointer notifications to the device’s seat when available. |
waylib/src/server/kernel/private/wcursor_p.h |
Add helper for resolving device seat. |
waylib/src/server/kernel/device_info_parser.h |
New parser interface for /proc/bus/input/devices. |
waylib/src/server/kernel/device_info_parser.cpp |
Implementation of /proc parsing cache for physical path lookup. |
waylib/src/server/kernel/WSeatManager |
Public include wrapper for WSeatManager. |
waylib/src/server/CMakeLists.txt |
Build integration for new seat manager + device info parser sources/headers. |
src/surface/seatsurfacecontainer.h |
New per-seat surface state container (focus, move/resize, meta state). |
src/surface/seatsurfacecontainer.cpp |
Implement per-seat activation/focus/move-resize state transitions. |
src/seat/helper.h |
Add multi-seat APIs, caches, and new seat-related helpers. |
src/seat/helper.cpp |
Wire in WSeatManager, seat config load/save, per-seat focus/event routing. |
src/input/inputdevice.cpp |
Add null checks before touchpad initialization. |
src/core/rootsurfacecontainer.h |
Introduce per-seat container map + per-seat move/resize/activation APIs. |
src/core/rootsurfacecontainer.cpp |
Implement per-seat state management and per-seat request handlers. |
src/CMakeLists.txt |
Add new SeatSurfaceContainer sources to the QML module build. |
879d306 to
935ccd2
Compare
There was a problem hiding this comment.
Sorry @Dami-star, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
95a903b to
1f42846
Compare
1f42846 to
c9a86a6
Compare
c9a86a6 to
bc5864d
Compare
|
TAG Bot New tag: 0.8.5 |
65141e6 to
4bfc935
Compare
4bfc935 to
afb134e
Compare
waylib/src/server/kernel/wseat.cpp
Outdated
| } | ||
| } | ||
|
|
||
| bool WSeat::matchesDevice(WInputDevice *device, const QList<QRegularExpression> &rules) const |
ddc9c31 to
cc9e230
Compare
cc9e230 to
be88f9c
Compare
|
|
||
| auto *helper = Helper::instance(); | ||
| if (helper && helper->activatedSurface() == wrapper) { | ||
| helper->setActivatedSurface(nullptr); |
There was a problem hiding this comment.
这里必须手动清空吗?
理论上 markWrapperToRemoved -》 m_container->removeSurface(this); -》SurfaceWrapper::setHasInitializeContainer(false) -》Q_EMIT requestInactive(); 触发焦点更替
There was a problem hiding this comment.
在 multi-seat 场景下,这个手动清空是必要的;
Helper::m_activatedSurface (全局) 和 SeatSurfaceManager::m_activatedSurface (per-seat) 是两个独立的状态。前者用于全局操作(快捷键、窗口菜单等),后者用于每个 seat 的独立交互。
SeatSurfaceManager::surfaceDestroyed() 只清理 per-seat 的状态,不会自动清理全局的 Helper::m_activatedSurface。
requestInactive 信号的处理器会调用 activateSurface(latestActiveSurface),目的是切换到另一个窗口,而不是简单地清空。如果 workspace 中还有其他窗口,它会激活那个窗口,而不是设置为 nullptr。
如果不手动清空,在 markWrapperToRemoved() 执行期间,全局 activatedSurface 仍然指向即将销毁的对象,可能导致悬空指针访问。
所以这里的手动清空是为了确保全局状态的及时清理,与 per-seat 的自动清理机制是互补的。
之前详细测试再设计如此的
There was a problem hiding this comment.
每个seat的光标、键盘 都可独立操作不同的窗口;
0cb099e to
ea376e3
Compare
|
ping ! |
src/seat/helper.cpp
Outdated
| m_backend->handle()->start(); | ||
| } | ||
|
|
||
| void Helper::initSeatConfig() |
There was a problem hiding this comment.
这些操作怎么不放到seatmanager里做,现在的helper负担太大了。
a16146e to
a3c87b1
Compare
Core features: - Add WSeatManager for seat configuration management - Extend WSeat with device rule matching capabilities
a3c87b1 to
99597b6
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Dami-star, zccrs 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 |
Core features: