Repository navigation
fix: preserve Dock behavior after display reconnection [cherry-pick] - #1892
Conversation
1. Restore layer-shell integration when platform windows are created. 2. Refresh edge wakeup areas when screens are added or primary changes. 3. Rebind overlap monitoring when the Dock changes screens. Influence: 1. Reconnect the only display and verify the Dock remains a layer surface. 2. In always-hidden mode, reconnect and reveal the Dock from the screen edge. 3. In smart-hide mode, reconnect with a maximized window and verify hiding. fix: 修复显示器重连后任务栏角色与隐藏行为异常 1. 平台窗口创建时自动恢复 layer-shell 集成,保留构造阶段补绑定。 2. 屏幕加入或主屏切换时更新边缘唤醒区域。 3. 任务栏切换屏幕时重新注册遮挡检测区域。 Influence: 1. 拔插唯一显示器,确认任务栏保持 layer-shell 角色。 2. 一直隐藏模式下重连显示器,确认可从屏幕边缘唤出任务栏。 3. 智能隐藏模式下保持窗口最大化并重连,确认任务栏恢复隐藏。 Log: Restore Dock window roles and hiding behavior after display reconnects. Log: 修复显示器重连后任务栏变成普通窗口、无法唤出或不再隐藏的问题。 Issue: None (cherry picked from commit 20dd983)
Reviewer's GuideImplementationRestore Wayland layer-shell integration when the platform surface is created, while retaining initial binding during construction.
Rebind Dock overlap monitoring when its screen changes, and rely on the layer-shell window event filter when showing the Dock.
Refresh edge wakeup areas when screens are added or the primary screen changes.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 4 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="150" />
<code_context>
connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos);
+ connect(m_panel, &DockPanel::dockScreenChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateRegionWatchPos);
</code_context>
<issue_to_address>
**Dock crashes without a screen**
When the last display is removed while a SmartHide region watch is active and the Dock window has no screen, `dockScreenChanged` invokes `updateRegionWatchPos()`, which dereferences `m_panel->window()->screen()` (and its handle) without checking for null, crashing the Dock during reconnection.
Check that the window has a screen before dereferencing it, and defer updating the region watch until a screen is available.
</issue_to_address>
### Comment 2
<location path="frame/layershell/dlayershellwindow.cpp" line_range="284-286" />
<code_context>
+ if (watched == d->parentWindow && event->type() == QEvent::PlatformSurface) {
+ auto *surfaceEvent = static_cast<QPlatformSurfaceEvent *>(event);
+ if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated
+ && dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle())) {
+ // Only bind the existing platform window; never create one from this event.
+ if (!installWaylandShellIntegration())
+ qCWarning(layershellwindow) << "Failed to restore layer-shell integration for" << d->scope;
+ }
</code_context>
<issue_to_address>
**XEmbed positioning uses stale surface**
When display reconnection recreates the Dock’s Wayland platform surface and an XEmbed window is subsequently moved, `WaylandDockHelper` caches the Dock’s `wl_surface` before reconnection, but this restoration path does not refresh that cache when a new platform surface is created. `moveXEmbedWindow()` only reacquires the surface when the cached pointer is null, so a later XEmbed move sends the destroyed surface to Wayland instead of positioning the window.
Refresh or clear the cached Dock surface when the platform surface is destroyed or created, before it can be used for XEmbed positioning.
</issue_to_address>
### Comment 3
<location path="frame/layershell/dlayershellwindow.h" line_range="151" />
<code_context>
void setCloseOnDismissed(bool close);
bool closeOnDismissed() const;
- bool ensureWaylandShellIntegration();
-
/** Whether a system resize is pending or active on this layer surface. */
</code_context>
<issue_to_address>
**Downstream consumers lose layer-shell API**
When a downstream consumer calls `DLayerShellWindow::ensureWaylandShellIntegration()`, removing the public declaration makes downstream consumers fail to compile, and removing the exported symbol makes already-built consumers fail to load.
Retain the public declaration and exported implementation, or provide a compatible replacement.
</issue_to_address>
### Comment 4
<location path="panels/dock/dockpanel.cpp" line_range="514" />
<code_context>
if (!waylandScreen || !waylandScreen->output())
return;
- if (DS_NAMESPACE::DLayerShellWindow::get(win)->ensureWaylandShellIntegration())
- win->show();
+ win->show();
}
</code_context>
<issue_to_address>
**Dock appears as ordinary window**
When layer-shell integration fails while `updateDockScreen()` is showing the Dock, `win->show()` runs despite the failed integration, so the Dock is displayed with an ordinary shell role instead of remaining hidden or a layer surface.
Only call `win->show()` when layer-shell integration succeeds.
</issue_to_address>|
|
||
| connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos); | ||
| connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos); | ||
| connect(m_panel, &DockPanel::dockScreenChanged, this, &WaylandDockHelper::updateRegionWatchPos); |
There was a problem hiding this comment.
🟠 High · Dock crashes without a screen
When the last display is removed while a SmartHide region watch is active and the Dock window has no screen, dockScreenChanged invokes updateRegionWatchPos(), which dereferences m_panel->window()->screen() (and its handle) without checking for null, crashing the Dock during reconnection.
Check that the window has a screen before dereferencing it, and defer updating the region watch until a screen is available.
Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at line 150:
**Dock crashes without a screen**
When the last display is removed while a SmartHide region watch is active and the Dock window has no screen, `dockScreenChanged` invokes `updateRegionWatchPos()`, which dereferences `m_panel->window()->screen()` (and its handle) without checking for null, crashing the Dock during reconnection.
Check that the window has a screen before dereferencing it, and defer updating the region watch until a screen is available.| && dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle())) { | ||
| // Only bind the existing platform window; never create one from this event. | ||
| if (!installWaylandShellIntegration()) |
There was a problem hiding this comment.
🟡 Medium · XEmbed positioning uses stale surface
When display reconnection recreates the Dock’s Wayland platform surface and an XEmbed window is subsequently moved, WaylandDockHelper caches the Dock’s wl_surface before reconnection, but this restoration path does not refresh that cache when a new platform surface is created. moveXEmbedWindow() only reacquires the surface when the cached pointer is null, so a later XEmbed move sends the destroyed surface to Wayland instead of positioning the window.
Refresh or clear the cached Dock surface when the platform surface is destroyed or created, before it can be used for XEmbed positioning.
Prompt for AI agents
In `frame/layershell/dlayershellwindow.cpp` at lines 284-286:
**XEmbed positioning uses stale surface**
When display reconnection recreates the Dock’s Wayland platform surface and an XEmbed window is subsequently moved, `WaylandDockHelper` caches the Dock’s `wl_surface` before reconnection, but this restoration path does not refresh that cache when a new platform surface is created. `moveXEmbedWindow()` only reacquires the surface when the cached pointer is null, so a later XEmbed move sends the destroyed surface to Wayland instead of positioning the window.
Refresh or clear the cached Dock surface when the platform surface is destroyed or created, before it can be used for XEmbed positioning.| void setCloseOnDismissed(bool close); | ||
| bool closeOnDismissed() const; | ||
|
|
||
| bool ensureWaylandShellIntegration(); |
There was a problem hiding this comment.
🟡 Medium · Downstream consumers lose layer-shell API
When a downstream consumer calls DLayerShellWindow::ensureWaylandShellIntegration(), removing the public declaration makes downstream consumers fail to compile, and removing the exported symbol makes already-built consumers fail to load.
Retain the public declaration and exported implementation, or provide a compatible replacement.
Prompt for AI agents
In `frame/layershell/dlayershellwindow.h` at line 151:
**Downstream consumers lose layer-shell API**
When a downstream consumer calls `DLayerShellWindow::ensureWaylandShellIntegration()`, removing the public declaration makes downstream consumers fail to compile, and removing the exported symbol makes already-built consumers fail to load.
Retain the public declaration and exported implementation, or provide a compatible replacement.| return; | ||
| if (DS_NAMESPACE::DLayerShellWindow::get(win)->ensureWaylandShellIntegration()) | ||
| win->show(); | ||
| win->show(); |
There was a problem hiding this comment.
🟡 Medium · Dock appears as ordinary window
When layer-shell integration fails while updateDockScreen() is showing the Dock, win->show() runs despite the failed integration, so the Dock is displayed with an ordinary shell role instead of remaining hidden or a layer surface.
Only call win->show() when layer-shell integration succeeds.
Prompt for AI agents
In `panels/dock/dockpanel.cpp` at line 514:
**Dock appears as ordinary window**
When layer-shell integration fails while `updateDockScreen()` is showing the Dock, `win->show()` runs despite the failed integration, so the Dock is displayed with an ordinary shell role instead of remaining hidden or a layer surface.
Only call `win->show()` when layer-shell integration succeeds.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, 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 |
Cherry-pick commit 20dd983 to develop/2500u3.
Source pull request #1891
Influence:
fix: 修复显示器重连后任务栏角色与隐藏行为异常
Influence:
Log: Restore Dock window roles and hiding behavior after display reconnects.
Log: 修复显示器重连后任务栏变成普通窗口、无法唤出或不再隐藏的问题。
Issue: None
Summary by Sourcery
Preserve Dock window roles, edge wakeup, and hide behavior across display reconnections and screen changes.
Bug Fixes: