Repository navigation
fix: restore X11 layer screen switching compatibility - #1910
Conversation
1. Restrict output latching to background surfaces to preserve desktop placement when rearranging extended screens. 2. Restore QWindow::screen() tracking for other layers to fix dock freezes and incorrect screen selection outlines. 3. Update the latched output before switching the window screen and remove redundant notification center rebinding. Influence: 1. Rearrange extended screens and verify both desktop backgrounds. 2. Switch primary screens with the dock following the primary screen or mouse. 3. Select HDMI and eDP in display settings and verify the matching outlines. 4. Verify notification center, notification bubbles and OSD after switching. fix: 修复多屏切换卡死及屏幕选中描边错位 1. 将输出锁存限定为背景层,保留扩展屏重排时的桌面背景归属。 2. 其他层恢复跟随 QWindow::screen(),修复任务栏卡死及选屏描边错屏, 无需修改控制中心等现有调用方。 3. 切换窗口屏幕前同步锁存输出,移除通知中心多余的屏幕重绑调用。 Influence: 1. 扩展模式下调整屏幕排列,确认主副屏背景正常显示。 2. 分别设置任务栏跟随主屏、跟随鼠标,切换主屏后确认无卡死。 3. 点击显示设置中的 HDMI、eDP 缩略图,确认描边对应正确屏幕。 4. 切屏后确认通知中心、通知气泡及 OSD 的位置和交互正常。 Log: 修复多屏切换导致任务栏卡死及屏幕选中描边错位,保留副屏背景重排修复。 PMS: TASK-384487, TASK-384649
Reviewer's GuideAPIClarify that
Uses of the APIKeep the dock’s explicit screen selection routed through
Let the notification center follow the dock’s screen without redundant explicit rebinding.
ImplementationUpdate the stored screen before emitting
Latch output only for background surfaces; use the window’s current screen for other layers while retaining background fallback behavior and position updates.
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="frame/layershell/x11dlayershellemulation.cpp" line_range="157" />
<code_context>
{
- if (m_screen && qApp->screens().contains(m_screen.data())) {
+ if (m_dlayerShellWindow->layer() == DLayerShellWindow::LayerBackground
+ && m_screen && qApp->screens().contains(m_screen.data())) {
return m_screen.data();
}
</code_context>
<issue_to_address>
**Background surfaces return to old output**
When a non-background surface changes screens and is later changed to LayerBackground, `targetScreen()` prefers `m_screen`, which still holds the construction-time or last explicitly assigned screen because the screen change does not refresh it; the next position update therefore places the surface on its earlier output.
Refresh the latched screen when a non-background surface changes screens, or update it to the current screen when the surface becomes a background layer.
</issue_to_address>
### Comment 2
<location path="frame/layershell/x11dlayershellemulation.cpp" line_range="157" />
<code_context>
{
- if (m_screen && qApp->screens().contains(m_screen.data())) {
+ if (m_dlayerShellWindow->layer() == DLayerShellWindow::LayerBackground
+ && m_screen && qApp->screens().contains(m_screen.data())) {
return m_screen.data();
}
</code_context>
<issue_to_address>
**Layer changes leave surface misplaced**
When a surface changes layers while its latched screen differs from its current window screen, `layerChanged` calls `onLayerChanged()` without calling `onPositionChanged()`, so `targetScreen()` selects a different output but the surface keeps its previous geometry until another event; callers see it on the wrong output.
Recalculate the surface position when its layer changes.
</issue_to_address>
### Comment 3
<location path="frame/layershell/x11dlayershellemulation.cpp" line_range="156-157" />
<code_context>
QScreen *LayerShellEmulation::targetScreen() const
{
- if (m_screen && qApp->screens().contains(m_screen.data())) {
+ if (m_dlayerShellWindow->layer() == DLayerShellWindow::LayerBackground
+ && m_screen && qApp->screens().contains(m_screen.data())) {
return m_screen.data();
}
</code_context>
<issue_to_address>
**Background screen selection is ignored**
When a background layer changes screens through `QWindow::screen()` rather than `DLayerShellWindow::setScreen()`, `targetScreen()` keeps using the latched `m_screen`, so the window stays positioned on its old output even though `QWindow::screen()` changes.
Update the screen selector to call `DLayerShellWindow.setScreen()` for background layers, or otherwise synchronize the background latch when an explicit screen selection occurs.
</issue_to_address>
### Comment 4
<location path="frame/layershell/dlayershellwindow.h" line_range="123" />
<code_context>
+ * On Wayland this forwards to QWindow::setScreen(). On X11 only background
+ * surfaces latch their output to survive screen rearrangements; use this
+ * method to explicitly move an existing background surface. Other layers
+ * continue to follow QWindow::screen(), including changes made from QML.
*/
Q_INVOKABLE void setScreen(QScreen *screen);
</code_context>
<issue_to_address>
**Screen getter reports stale output**
When a non-background window is explicitly assigned a screen and is later moved by changing `QWindow::screen()` directly or from QML, `DLayerShellWindow::screen()` continues returning the last explicitly assigned `d->screen`, and its `screenChanged` signal is not forwarded when `QWindow::screen()` changes; C++ callers therefore observe the old output despite the documented dynamic tracking.
Make the getter and change notification for non-background layers reflect `QWindow::screen()`, while retaining the latched output for backgrounds.
</issue_to_address>
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy, xujin177 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 |
when rearranging extended screens.
incorrect screen selection outlines.
redundant notification center rebinding.
Influence:
fix: 修复多屏切换卡死及屏幕选中描边错位
无需修改控制中心等现有调用方。
Influence:
Log: 修复多屏切换导致任务栏卡死及屏幕选中描边错位,保留副屏背景重排修复。
PMS: TASK-384487, TASK-384649
Summary by Sourcery
Restore compatible screen tracking across X11 layer surfaces so multi-screen switching remains stable while desktop backgrounds retain their assigned outputs.
Bug Fixes:
Enhancements: