feat: add privileged overlay surface support - #1272
Conversation
Reviewer's GuideAdds support for a new 'privileged overlay' toplevel tag and surface role, including its own container, focus/activation rules, and geometry handling, refactors IM candidate panel detection to be wrapper-centric, and adjusts the lockscreen power popup to behave like a privileged overlay demo while expanding the test_toplevel_tag example to cover both tags. Sequence diagram for privileged overlay promotion on xdg_toplevel tag changesequenceDiagram
participant XdgSurface as WXdgToplevelSurface
participant ShellHandler
participant IMCandidatePanelManager
participant Wrapper as SurfaceWrapper
participant PrivContainer as SurfaceContainer
XdgSurface->>ShellHandler: tagChanged
ShellHandler->>IMCandidatePanelManager: checkAndApplyIMCandidatePanel(wrapperPtr)
ShellHandler->>ShellHandler: checkAndApplyPrivilegedOverlay(wrapperPtr)
ShellHandler->>Wrapper: applyPrivilegedOverlay(wrapper)
Wrapper->>Wrapper: flushPendingGeometryAnimation()
Wrapper->>PrivContainer: addSurface(wrapper)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
EN: This PR adds a “PrivilegedOverlay” surface role for xdg-toplevel surfaces tagged with org.deepin.treeland.privileged-overlay, placing them into a dedicated container rendered above the lock screen and excluding them from normal workspace activation/inactivation flows. It also refactors IM candidate panel detection to be wrapper-based for both XDG and XWayland, and updates the lockscreen power UI interaction.
**中文:**该 PR 为带有 org.deepin.treeland.privileged-overlay 的 xdg-toplevel 引入 “PrivilegedOverlay” 特权叠加层角色,将其放入独立容器并渲染在锁屏之上,同时从常规工作区激活/失活逻辑中排除;并将输入法候选窗检测改为基于 SurfaceWrapper 的统一逻辑(兼容 XDG 与 XWayland),以及调整锁屏电源菜单的交互行为。
Changes / 变更点:
- EN: Introduce
SurfaceRole::PrivilegedOverlayand a new privileged overlay container at a higher Z-order than the lock screen.
中文:新增SurfaceRole::PrivilegedOverlay及独立容器,并将其 Z 序设置为高于锁屏。 - EN: Unify IM candidate panel detection into
IMCandidatePanelManager::checkAndApplyIMCandidatePanel(SurfaceWrapper*)for XDG/XWayland.
中文:将输入法候选窗检测统一为checkAndApplyIMCandidatePanel(SurfaceWrapper*),同时支持 XDG/XWayland。 - EN: Update lockscreen power list UI to close on outside click and restore focus, plus expand the
test_toplevel_tagexample UI.
中文:锁屏电源列表支持点击外部关闭并恢复焦点,同时增强test_toplevel_tag示例界面。
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/workspace/workspace.cpp |
Skip privileged overlays in workspace active-surface stack. |
src/surface/surfacewrapper.h |
Add PrivilegedOverlay role and flushPendingGeometryAnimation() API. |
src/surface/surfacewrapper.cpp |
Implement flushPendingGeometryAnimation() to apply pending state/geometry immediately. |
src/seat/helper.cpp |
Allow activation assertions for privileged overlays outside current workspace. |
src/plugins/lockscreen/qml/LockView.qml |
Restore focus when the power list closes. |
src/plugins/lockscreen/qml/ControlAction.qml |
Replace power popup with an overlay item + outside-click dismissal and a close signal. |
src/core/shellhandler.h |
Add privileged overlay container accessor + promotion helpers. |
src/core/shellhandler.cpp |
Create privileged overlay container, promote tagged surfaces, exclude from inactivation removal. |
src/core/rootsurfacecontainer.h |
Add PrivilegedOverlayZOrder above lock screen. |
src/core/imcandidatepanelmanager.h |
Change IM candidate panel application API to wrapper-only. |
src/core/imcandidatepanelmanager.cpp |
Implement wrapper-based XDG tag / XWayland property detection in one path. |
src/common/treelandlogging.h |
Add logging category for privileged surfaces. |
src/common/treelandlogging.cpp |
Define the new privileged surface logging category. |
examples/test_toplevel_tag/main.cpp |
Add a combo box for supported toplevel tags (incl. privileged overlay). |
Suppressed comments (1)
src/core/shellhandler.cpp:540
- EN: When promoting a surface to PrivilegedOverlay, the wrapper may still have a non-null parent surface (transient relationship). After moving to a different container, calls like stackToLast() can end up stacking relative to a parent in another parentItem, which is invalid and can break stacking/focus.
中文:将窗口提升为 PrivilegedOverlay 后,如果仍保留 transient 的父子关系(parentSurface 非空),在迁移到不同 container 后再调用 stackToLast() 等会尝试相对不同 parentItem 的父窗口进行堆叠,可能导致堆叠/焦点异常。
Detach from the parent surface before removing/adding to containers (and keep the wrapper independent in the privileged container).
// Move from the original container to the privileged overlay container
if (auto *oldContainer = wrapper->container())
oldContainer->removeSurface(wrapper);
m_privilegedOverlayContainer->addSurface(wrapper);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Popup focus management | ||
| Q_LOGGING_CATEGORY(lcTlPopupFocus, "treeland.popup.focus") | ||
| // Privileged surface | ||
| Q_LOGGING_CATEGORY(lcTlPrivilegedSurface, "treeland.privileged.surface", QtInfoMsg) |
There was a problem hiding this comment.
不用定义那么细碎的日志分类,定义一个 treeland.shell.xdg 好了,xdg shell相关的所有日志都用它。相对应的还可以有 treeland.shell.layer
| // If a geometry animation (e.g. fullscreen transition) is in progress, abort it | ||
| // and apply the pending state immediately. The animation is bound to the old | ||
| // container's scene graph and cannot complete after the container change below. | ||
| wrapper->flushPendingGeometryAnimation(); |
There was a problem hiding this comment.
这里实现flushPendingGeometryAnimation主要是为了解决在之前在锁屏情况下,特权窗口直接创建并全屏显示会全屏失败,后面发现这是客户端并非特权窗口本身的bug,该bug已经在https://github.com/linuxdeepin/treeland/pull/1281这笔提交中测试通过了,我这里就把flushPendingGeometryAnimation删除了。
此外:禁用动画也已经添加。
| { | ||
| auto *xdgSurface = static_cast<WXdgToplevelSurface *>(wrapper->shellSurface()); | ||
| if (xdgSurface->tag() != PRIVILEGED_OVERLAY_TAG) | ||
| return false; |
There was a problem hiding this comment.
这里之前没有考虑到这种情况,正在添加这部分逻辑
a6621b0 to
f86350b
Compare
|
TAG Bot New tag: 0.8.18 |
be18f11 to
09406d0
Compare
| QObject::connect(fullscreenBtn, | ||
| &QPushButton::clicked, | ||
| &window, | ||
| [&window] { |
| window.showFullScreen(); | ||
| }); | ||
|
|
||
| QObject::connect(restoreBtn, |
| QPointer<SurfaceWrapper> wrapperPtr(wrapper); | ||
| QObject::connect(surface, &WXdgToplevelSurface::tagChanged, this, [this, wrapperPtr]() { | ||
| if (wrapperPtr) { | ||
| if (checkAndApplyPrivilegedOverlay(wrapperPtr)) return; |
| QObject::connect(surface, &WXdgToplevelSurface::tagChanged, this, [this, wrapperPtr]() { | ||
| if (wrapperPtr) { | ||
| if (checkAndApplyPrivilegedOverlay(wrapperPtr)) return; | ||
| if (m_imCandidatePanelManager->checkAndApplyIMCandidatePanel(wrapperPtr)) return; |
f9e366f to
ed71a8e
Compare
| { | ||
| if (m_type == Type::Layer || m_type == Type::XdgPopup || isInputPopupLike()) [[unlikely]] | ||
| if (m_type == Type::Layer || m_type == Type::XdgPopup || isInputPopupLike() | ||
| || surfaceRole() == SurfaceWrapper::SurfaceRole::PrivilegedOverlay) [[unlikely]] |
d5c6314 to
e8a8ab7
Compare
| PopupZOrder = 5, | ||
| CaptureLayerZOrder = 6, | ||
| LockScreenZOrder = 7, | ||
| GlobalOverlayZOrder = 10, |
There was a problem hiding this comment.
用100, PrivilegedOverlayZOrder改成200,中间空出一些
| #include <wxwaylandsurface.h> | ||
| #include <wxwaylandsurfaceitem.h> | ||
|
|
||
| #include <QtQuickTemplates2/private/qquickoverlay_p.h> |
There was a problem hiding this comment.
直接写 <private/qquickoverlay_p.h> 就行,放到QTimer后面
Add privileged overlay container and surface role for surfaces that should remain visible above the lock screen. Introduce logging category, z-order, tag-based detection, and geometry animation flush. Also reparent the entire QQuickOverlay from contentItem to rootSurfaceContainer with Z=10 (GlobalOverlayZOrder), so all QQuickPopup items (combo boxes, menus, tooltips, dimmers) render at the correct scene layer above lock screen and below privileged overlay. 新增特权叠加层容器和表面角色,使特定表面在锁屏状态下仍保持可见。 添加日志分类、Z轴层级、基于tag的检测。 将 QQuickOverlay 整体 reparent 到 rootSurfaceContainer,新增 GlobalOverlayZOrder 层级确保 popup 在正确 Z 序渲染。 Log: 添加特权叠加层表面支持;将 QQuickOverlay reparent 到 rootSurfaceContainer PMS: TASK-393961 Influence: 拥有 org.deepin.treeland.privileged-overlay tag 的 xdg-toplevel surface 将自动提升为特权叠加层,在锁屏时仍可见且不受 workspace 切换影响。
Add a QComboBox with supported treeland tags (im-candidate-panel and privileged-overlay) for quick tag selection. 在 toplevel-tag 测试 demo 中添加标签选择下拉框,支持快速选择 treeland 内置的两个 tag。 Log: 更新 test-toplevel-tag demo,添加下拉框选择标签 Influence: 仅在 examples 中新增 UI 控件,不影响其他功能。
e8a8ab7 to
1d23dab
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gugullll, 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 |
Summary by Sourcery
Add privileged overlay surface support with dedicated stacking, lifecycle handling, and lock-screen integration.
New Features:
Bug Fixes:
Enhancements:
Build: