Skip to content

feat: implement multi-seat support#758

Merged
zccrs merged 1 commit intolinuxdeepin:masterfrom
Dami-star:multi-seat-new
Mar 23, 2026
Merged

feat: implement multi-seat support#758
zccrs merged 1 commit intolinuxdeepin:masterfrom
Dami-star:multi-seat-new

Conversation

@Dami-star
Copy link
Collaborator

Core features:

  • Add WSeatManager for seat configuration management
  • Extend WSeat with device rule matching capabilities

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Dami-star, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@Dami-star Dami-star marked this pull request as draft March 3, 2026 08:34
@wineee wineee requested a review from Copilot March 3, 2026 08:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WSeatManager to create/manage seats and apply regex rules for auto-assigning input devices.
  • Extend WSeat/WInputDevice with 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 SeatSurfaceContainer and 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.

@Dami-star Dami-star force-pushed the multi-seat-new branch 2 times, most recently from 879d306 to 935ccd2 Compare March 4, 2026 06:44
@Dami-star Dami-star marked this pull request as ready for review March 4, 2026 06:53
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Dami-star, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@wineee wineee requested a review from Copilot March 4, 2026 07:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.

Copy link
Member

@zccrs zccrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还没看完

@deepin-bot
Copy link

deepin-bot bot commented Mar 6, 2026

TAG Bot

New tag: 0.8.5
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #771

@Dami-star Dami-star requested a review from zccrs March 9, 2026 01:30
@Dami-star Dami-star force-pushed the multi-seat-new branch 2 times, most recently from 65141e6 to 4bfc935 Compare March 11, 2026 03:27
@Dami-star Dami-star requested a review from zccrs March 11, 2026 03:41
}
}

bool WSeat::matchesDevice(WInputDevice *device, const QList<QRegularExpression> &rules) const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

跟着seatmanager一起挪走

@Dami-star Dami-star force-pushed the multi-seat-new branch 4 times, most recently from ddc9c31 to cc9e230 Compare March 13, 2026 05:18
@Dami-star Dami-star requested a review from zccrs March 13, 2026 05:20
@wineee wineee requested a review from Copilot March 17, 2026 01:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 9 comments.


auto *helper = Helper::instance();
if (helper && helper->activatedSurface() == wrapper) {
helper->setActivatedSurface(nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里必须手动清空吗?

理论上 markWrapperToRemoved -》 m_container->removeSurface(this); -》SurfaceWrapper::setHasInitializeContainer(false) -》Q_EMIT requestInactive(); 触发焦点更替

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 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 的自动清理机制是互补的。

之前详细测试再设计如此的

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

每个seat的光标、键盘 都可独立操作不同的窗口;

@Dami-star Dami-star force-pushed the multi-seat-new branch 2 times, most recently from 0cb099e to ea376e3 Compare March 17, 2026 05:39
@Dami-star Dami-star requested a review from wineee March 17, 2026 07:23
@Dami-star
Copy link
Collaborator Author

ping !

m_backend->handle()->start();
}

void Helper::initSeatConfig()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些操作怎么不放到seatmanager里做,现在的helper负担太大了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Dami-star Dami-star force-pushed the multi-seat-new branch 2 times, most recently from a16146e to a3c87b1 Compare March 18, 2026 08:51
Core features:
  - Add WSeatManager for seat configuration management
  - Extend WSeat with device rule matching capabilities
@Dami-star Dami-star requested a review from zccrs March 19, 2026 00:59
@deepin-ci-robot
Copy link

[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.

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

@zccrs zccrs merged commit d765147 into linuxdeepin:master Mar 23, 2026
12 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.

5 participants