Repository navigation
[2500u3] feat(dock): route dock tooltip and preview through shared context - #1834
Conversation
1. Add a shared dock preview context API to DockPanel and DockHelper so applets share the panel's Wayland context. 2. Move TreeLandDockPreviewManager and TreeLandDockPreviewContext into WaylandDockHelper with a single context per anchor. 3. Add tooltip surface support with a dedicated shell integration that defers role assignment until the first buffer commit. 4. Connect tooltip window show/hide and frameSwapped events to show and close the tooltip via the preview context. 5. Make TreeLandWindowMonitor use the panel-provided preview context instead of creating its own. 6. Bump TreelandProtocols requirement to 0.9.0 and add the foreign- toplevel-manager protocol. Log: Dock tooltip and window preview now share a unified Wayland preview context Influence: Dock tooltips and previews become more stable on Treeland feat(dock): 通过共享上下文统一处理任务栏提示与预览 1. 在 DockPanel 和 DockHelper 中新增共享的停靠预览上下文接口,使各插件复 用面板的 Wayland 上下文。 2. 将 TreeLandDockPreviewManager 和 TreeLandDockPreviewContext 移入 WaylandDockHelper,每个锚点仅维护一个上下文。 3. 新增工具提示 surface 支持,使用专用 shell integration 延迟角色分配至 首个缓冲区提交。 4. 连接提示窗口的显示/隐藏及帧交换事件,通过预览上下文显示和关闭提示。 5. 使 TreeLandWindowMonitor 使用面板提供的预览上下文,不再自行创建。 6. 将 TreelandProtocols 依赖升级至 0.9.0,并新增 foreign-toplevel- manager 协议。 Log: 任务栏提示与窗口预览现共用统一的 Wayland 预览上下文 Influence: 提升 Treeland 下任务栏提示与预览的稳定性 PMS: TASK-398771 (cherry picked from commit 8729ab7)
Reviewer's GuideAPIExpose the dock preview context through DockHelper and DockPanel so dock applets can request the panel’s shared context.
Uses of the APIPass the parent applet to the Treeland window monitor and adapt the monitor to obtain, reuse, and release the panel-provided preview context.
ImplementationImplement shared Wayland preview contexts and compositor-managed tooltip surfaces, including context lifecycle and tooltip show/close handling.
UIUpdate the QML tooltip to derive readiness from the active shared context, close on visibility and destruction changes, and parent its content only while ready.
ConfigurationRequire TreelandProtocols 0.9.0 and generate the foreign-toplevel-manager protocol for the dock panel.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/dock/waylanddockhelper.cpp" line_range="192-193" />
<code_context>
+
+ switch (event->type()) {
+ case QEvent::Show: {
+ if (!dockPreviewContext(m_panel->window()))
+ break;
+
+ // QShowEvent precedes QWaylandWindow::setVisible(), where Qt assigns a role.
</code_context>
<issue_to_address>
**Tooltip stays unmanaged**
When the preview manager is not active when the tooltip receives its Show event, for example while the compositor protocol is still activating, the show handler leaves the tooltip without the dedicated shell integration and preview context; later frame callbacks return without showing it, and activation of the preview manager does not retry setup while the tooltip remains visible. The user sees no compositor-managed tooltip until it is hidden and shown again.
Retry context creation and tooltip shell setup when the preview manager becomes active, including for an already-visible tooltip.
Also at `panels/dock/waylanddockhelper.cpp:232-233`.
</issue_to_address>
### Comment 2
<location path="panels/dock/waylanddockhelper.cpp" line_range="234-241" />
<code_context>
+{
+ if (!anchor || !m_previewManager->isActive())
+ return nullptr;
+ if (m_dockPreview && m_previewAnchor == anchor)
+ return m_dockPreview.get();
+
+ auto *native = dynamic_cast<QtWaylandClient::QWaylandWindow *>(anchor->handle());
+ if (!native || !native->wlSurface())
+ return nullptr;
+
+ resetDockPreview();
+ m_previewAnchor = anchor;
+ auto *context = m_previewManager->get_dock_preview_context(native->wlSurface());
</code_context>
<issue_to_address>
**Applets replace each other’s context**
When two applets request a context using different `QWindow` anchors, `dockPreviewContext` stores only one `m_dockPreview`; when a later caller supplies a different anchor, `resetDockPreview()` destroys the existing context and creates one for the new anchor. Applets using distinct `QWindow` anchors therefore do not share a stable panel context, and their tooltip or preview can be closed when another applet requests one.
Normalize requests to the panel window or retain a context per anchor without resetting other applets’ contexts.
</issue_to_address>| if (!dockPreviewContext(m_panel->window())) | ||
| break; |
There was a problem hiding this comment.
🟡 Medium · Tooltip stays unmanaged
When the preview manager is not active when the tooltip receives its Show event, for example while the compositor protocol is still activating, the show handler leaves the tooltip without the dedicated shell integration and preview context; later frame callbacks return without showing it, and activation of the preview manager does not retry setup while the tooltip remains visible. The user sees no compositor-managed tooltip until it is hidden and shown again.
Retry context creation and tooltip shell setup when the preview manager becomes active, including for an already-visible tooltip.
Also at panels/dock/waylanddockhelper.cpp:232-233.
Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at lines 192-193:
**Tooltip stays unmanaged**
When the preview manager is not active when the tooltip receives its Show event, for example while the compositor protocol is still activating, the show handler leaves the tooltip without the dedicated shell integration and preview context; later frame callbacks return without showing it, and activation of the preview manager does not retry setup while the tooltip remains visible. The user sees no compositor-managed tooltip until it is hidden and shown again.
Retry context creation and tooltip shell setup when the preview manager becomes active, including for an already-visible tooltip.
Also at `panels/dock/waylanddockhelper.cpp:232-233`.| if (m_dockPreview && m_previewAnchor == anchor) | ||
| return m_dockPreview.get(); | ||
|
|
||
| auto *native = dynamic_cast<QtWaylandClient::QWaylandWindow *>(anchor->handle()); | ||
| if (!native || !native->wlSurface()) | ||
| return nullptr; | ||
|
|
||
| resetDockPreview(); |
There was a problem hiding this comment.
🟡 Medium · Applets replace each other’s context
When two applets request a context using different QWindow anchors, dockPreviewContext stores only one m_dockPreview; when a later caller supplies a different anchor, resetDockPreview() destroys the existing context and creates one for the new anchor. Applets using distinct QWindow anchors therefore do not share a stable panel context, and their tooltip or preview can be closed when another applet requests one.
Normalize requests to the panel window or retain a context per anchor without resetting other applets’ contexts.
Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at lines 234-241:
**Applets replace each other’s context**
When two applets request a context using different `QWindow` anchors, `dockPreviewContext` stores only one `m_dockPreview`; when a later caller supplies a different anchor, `resetDockPreview()` destroys the existing context and creates one for the new anchor. Applets using distinct `QWindow` anchors therefore do not share a stable panel context, and their tooltip or preview can be closed when another applet requests one.
Normalize requests to the panel window or retain a context per anchor without resetting other applets’ contexts.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MyLeeJiEun, wjyrich 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 |
e22005a
into
linuxdeepin:develop/2500u3
Backport #1813 to
develop/2500u3so Wayland dock tooltips and window previews use the panel's shared preview context.Source commit:
8729ab7636d4e0a027af78eaaa19969d0d6be024.The cherry-picked patch has the same stable patch ID as the source commit.
Changes
Validation
git diff --check upstream/develop/2500u3...HEAD: passed.BUILD_TESTING=ON: passed.dockpanel,dock-taskmanager, andhoverpreviewproxymodel_tests: passed.QT_QPA_PLATFORM=offscreen ctest --test-dir /tmp/dde-shell-pr1813-2500u3-build -R 'HoverPreview' --output-on-failure: 14/14 passed.qmlformatparsing ofPanelToolTip.qml: passed.中文说明
将 #1813 移植到
develop/2500u3,让 Wayland 下的任务栏提示与窗口预览共用面板上下文。无冲突移植,补丁与原提交一致;相关目标编译、QML 语法检查和 14 项预览模型测试均通过。Treeland 会话中的提示与预览交互仍需手动验证。
PMS: TASK-398771
Summary by Sourcery
Share the dock panel's Wayland preview context so tooltips and window previews use consistent lifecycle and compositor-managed surfaces.
New Features:
Bug Fixes:
Enhancements:
Build: