Repository navigation
Conversation
Reviewer's GuideAPIAdd a method that ensures the Wayland layer-shell integration is installed and reports whether it succeeded.
Uses of the APIOn display changes, restore the Dock only when the primary screen is ready and the Dock is eligible to show, reinstalling layer-shell integration first.
ImplementationUse the shared layer-shell setup helper when creating a layer-shell window, and avoid assigning the integration again when a shell surface already exists.
Skip task icon geometry updates when the base window or its Wayland platform window is unavailable.
ConfigurationKeep dde-shell running after its last window closes so it can recover when displays reconnect.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 5 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/dock/dockpanel.cpp" line_range="487" />
<code_context>
- delete shellIntegration;
- shellIntegration = nullptr;
- qCWarning(layershellwindow) << "failed to init dlayershell intergration";
- return;
- }
- }
</code_context>
<issue_to_address>
**Non-primary Dock stays hidden**
When the Dock is assigned to an external display, `showInPrimary()` is false, and that display is removed and reconnected, `primaryScreenChanged` is not connected in this screen-selection mode, so `updateDockScreen()` does not select a replacement screen or reach `win->show()` after reconnection; the Dock stays hidden.
Register a display-change recovery path for non-primary screen-selection modes so the Dock selects a replacement screen and is shown after reconnection.
Also at `panels/dock/dockpanel.cpp:493`.
</issue_to_address>
### Comment 2
<location path="frame/layershell/dlayershellwindow.cpp" line_range="297-299" />
<code_context>
+ }
+ }
+
+ if (!waylandWindow->shellSurface())
+ waylandWindow->setShellIntegration(shellIntegration);
+ return waylandWindow->shellIntegration() == shellIntegration;
+}
+
</code_context>
<issue_to_address>
**Dock stays hidden after reconnect**
When a reconnected Wayland window has a non-null shell surface created with an integration other than the layer-shell integration, `ensureWaylandShellIntegration()` skips `setShellIntegration()` because `shellSurface()` is non-null, then returns false because the integrations differ; `updateDockScreen()` consequently does not call `win->show()`, and the Dock stays hidden.
Make `ensureWaylandShellIntegration()` install or otherwise ensure the layer-shell integration based on integration identity, rather than skipping installation whenever a shell surface exists.
</issue_to_address>
### Comment 3
<location path="panels/dock/dockpanel.cpp" line_range="491-492" />
<code_context>
- delete shellIntegration;
- shellIntegration = nullptr;
- qCWarning(layershellwindow) << "failed to init dlayershell intergration";
- return;
- }
- }
</code_context>
<issue_to_address>
**Dock stays hidden after readiness**
When a primary-screen change arrives before the Wayland output or layer-shell integration is ready, and readiness follows without another primary-screen change, `updateDockScreen()` returns when the output is unavailable or does not show the Dock when `ensureWaylandShellIntegration()` fails, and neither path schedules another attempt; the Dock stays hidden.
Retry `updateDockScreen()` when the Wayland output and layer-shell integration become ready.
</issue_to_address>
### Comment 4
<location path="panels/dock/dockpanel.cpp" line_range="487" />
<code_context>
- delete shellIntegration;
- shellIntegration = nullptr;
- qCWarning(layershellwindow) << "failed to init dlayershell intergration";
- return;
- }
- }
</code_context>
<issue_to_address>
**Dock stays unmapped after reconnect**
When the Dock retains its visible flag after its active output is disconnected and the primary-screen change is processed, `win->isVisible()` remains true even though the disconnected output left the Dock’s platform surface unmapped, so `updateDockScreen()` returns without reinstalling layer-shell integration or showing the Dock; the Dock remains missing after reconnection.
Check whether the Wayland platform surface and layer-shell surface are actually usable, and restore them on reconnect even when the QWindow’s visible flag is still true.
</issue_to_address>
### Comment 5
<location path="panels/dock/taskmanager/treelandwindow.cpp" line_range="233" />
<code_context>
+
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(baseWindow->handle());
- if (waylandWindow->surface() == nullptr || gemeotry.isEmpty())
+ if (!waylandWindow || waylandWindow->surface() == nullptr || gemeotry.isEmpty())
return;
</code_context>
<issue_to_address>
**Skipped icon geometry is never retried**
When the one-shot icon-geometry update runs during a hotplug gap and the delegate geometry does not change after reconnection, `setWindowIconGeometry()` returns while the delegate’s platform window is unavailable, discarding the pending geometry. If the platform window returns without another delegate geometry or window-list change, the compositor keeps stale icon geometry until a later update.
Retain the latest requested geometry and resend it when the platform surface becomes available, or schedule a retry after reconnection.
</issue_to_address>
gugullll
left a comment
There was a problem hiding this comment.
在四处关键改动旁补充了显示器热拔插时的触发条件和修改原因。
| setenv("DSG_APP_ID", "org.deepin.dde.shell", 0); | ||
| DGuiApplicationHelper::setAttribute(DGuiApplicationHelper::UseInactiveColorGroup, false); | ||
| DApplication a(argc, argv); | ||
| a.setQuitOnLastWindowClosed(false); |
There was a problem hiding this comment.
拔掉唯一输出时,合成器会向 Dock 的 layer surface 发送 closed,旧逻辑随即关闭 Dock 窗口。若它是最后一个可见的主窗口,Qt 默认会退出 dde-shell。保留进程后,Qt Wayland 客户端才能继续接收显示器插回和主屏变化的通知。
There was a problem hiding this comment.
如果这个PR完全只设 setQuitOnLastWindowClosed(false) 不做别的修改的话,会有效果不?
There was a problem hiding this comment.
只是让这个进程没有直接退出,但是已经丢失了layshell角色,变成普通窗口了,需要重建
|
|
||
| auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(baseWindow->handle()); | ||
| if (waylandWindow->surface() == nullptr || gemeotry.isEmpty()) | ||
| if (!waylandWindow || waylandWindow->surface() == nullptr || gemeotry.isEmpty()) |
There was a problem hiding this comment.
Dock 关闭后,QML 的延迟定时器仍可能触发图标位置上报。此时 QWindow 对象可以还在,但它的 QWaylandWindow 已被销毁。崩溃落在这里的空指针解引用,因此平台窗口或 surface 不可用时应跳过本次上报。
| auto *waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(primary->handle()); | ||
| if (!waylandScreen || !waylandScreen->output()) | ||
| return; | ||
| if (DS_NAMESPACE::DLayerShellWindow::get(win)->ensureWaylandShellIntegration()) |
There was a problem hiding this comment.
零屏时 Qt 会提供没有真实 wl_output 的占位屏,所以要等有效主屏可用。切屏后先确认 layer-shell integration 已装好,再调用 show(),让新 surface 按原有锚点显示。直接 show() 在实测中会走默认的普通窗口角色,Dock 因而贴错边。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, gugullll 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 |
1. Keep dde-shell running when the last window closes. 2. Skip icon geometry updates while the platform window is unavailable. 3. Reinstall layer-shell integration before showing the Dock again. Log: Restore the Dock at its configured edge after a display reconnects. Influence: 1. Unplug and reconnect the only display, then check the Dock position. 2. Unplug the active external display in external-only mode and check Dock. 3. Repeat hotplug with open windows and check for crashes or restarts. fix: 修复显示器重新接入后任务栏不恢复 1. 最后一个窗口关闭后保持 dde-shell 运行。 2. 平台窗口不可用时跳过任务图标位置上报。 3. 恢复任务栏前重新绑定 layer-shell。 Log: 显示器重新接入后,任务栏恢复到配置的屏幕边缘。 Influence: 1. 拔出并插回唯一显示器,确认任务栏恢复到原边缘。 2. 仅使用外接显示器时拔掉外接屏,检查任务栏是否恢复。 3. 打开多个窗口后反复拔插,检查 dde-shell 是否崩溃或重启。 PMS: BUG-382863
4da60ed to
699509a
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['建议在调用 DLayerShellWindow::get(win) 后添加空指针检查:auto *layerShell = DLayerShellWindow::get(win); if (!layerShell) return; if (layerShell->ensureWaylandShellIntegration()) win->show();'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ["建议在 updateDockScreen() 的复杂条件前添加注释,说明仅在'主屏变化信号来自 qApp、窗口在主屏上、窗口当前不可见但应处于显示状态'时才恢复 Dock 显示", '建议将参数名 gemeotry 修正为 geometry'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// dockpanel.cpp - 建议添加空指针检查
void DockPanel::updateDockScreen()
{
auto *win = window();
if (!win)
return;
auto *primary = qApp->primaryScreen();
setDockScreen(primary);
// 仅在主屏变化且窗口需要恢复时重新显示
if (sender() != qApp || !primary || win->screen() != primary || win->isVisible() || hideState() != Show)
return;
auto *waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(primary->handle());
if (!waylandScreen || !waylandScreen->output())
return;
auto *layerShell = DS_NAMESPACE::DLayerShellWindow::get(win);
if (!layerShell) // 添加空指针检查
return;
if (layerShell->ensureWaylandShellIntegration())
win->show();
}本报告由 AI 代码审查工具自动生成 |
Log: Restore the Dock at its configured edge after a display reconnects.
Influence:
fix: 修复显示器重新接入后任务栏不恢复
Log: 显示器重新接入后,任务栏恢复到配置的屏幕边缘。
Influence:
Summary by Sourcery
Restore Dock availability and placement after displays are disconnected and reconnected.
Bug Fixes:
Enhancements: