Skip to content

fix: migrate windows and layer surfaces on primary output hot-unplug#1024

Draft
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/primary-hotunplug-migration
Draft

fix: migrate windows and layer surfaces on primary output hot-unplug#1024
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/primary-hotunplug-migration

Conversation

@deepin-wm

Copy link
Copy Markdown
Contributor

Summary

Fix windows and layer surfaces not displaying on remaining screen after primary output hot-unplug in extension mode.

Changes

  1. outputlifecyclemanager.cpp/.h: Fix onScreenRemoved missing primary migration when removeOutput already switched primary output before onScreenRemoved is called. Extract migrateSurfacesToNewPrimary as a public method to eliminate duplicated migration logic.

  2. rootsurfacecontainer.cpp: Add position correction for remaining output surfaces after output layout change, with normalGeometry sync for XdgToplevel to ensure maximize/restore works correctly.

  3. layersurfacecontainer.cpp: Migrate layer surfaces to remaining output instead of closing them when output is removed, and trigger arrangeLayerSurfaces for final layout.

Test Plan

  • Test hot-unplug primary output (HDMI) in dual-screen extension mode
  • Verify windows on secondary screen move correctly to remaining screen
  • Verify layer surfaces (panel/dock) migrate correctly after unplug
  • Test maximize/restore window after output removal
  • Verify Copy mode is not affected

Fixes: #1

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @deepin-wm, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-wm deepin-wm force-pushed the fix/primary-hotunplug-migration branch from 445c561 to 87a225b Compare June 18, 2026 12:49
1. Fix onScreenRemoved missing primary migration when removeOutput
   already switched primary output before onScreenRemoved is called
2. Extract migrateSurfacesToNewPrimary as a public method to
   eliminate duplicated migration logic in onScreenRemoved and
   onScreenDisabled
3. Add position correction for remaining output surfaces after
   output layout change, with normalGeometry sync for XdgToplevel
4. Migrate layer surfaces to remaining output instead of closing
   them when output is removed, and trigger arrangeLayerSurfaces
   for final layout

Log: Fix windows and layer surfaces not displaying on remaining screen after primary output hot-unplug in extension mode

Influence:
1. Test hot-unplug primary output in dual-screen extension mode
2. Verify windows on secondary screen move correctly to remaining screen
3. Verify layer surfaces (panel/dock) migrate correctly after unplug
4. Test maximize/restore window after output removal
5. Verify Copy mode is not affected by the changes

fix: 主屏热插拔时正确迁移窗口和层表面

1. 修复 onScreenRemoved 缺失主屏迁移逻辑,当 removeOutput
   在 onScreenRemoved 之前已切换主屏输出时
2. 提取 migrateSurfacesToNewPrimary 为公共方法,消除
   onScreenRemoved 和 onScreenDisabled 中的重复迁移逻辑
3. 添加输出布局变化后剩余输出上表面位置校正,同步更新
   XdgToplevel 的 normalGeometry
4. 输出移除时将层表面迁移到剩余输出而非关闭,并触发
   arrangeLayerSurfaces 进行最终布局

Log: 修复扩展模式下拔掉主屏后窗口和面板不显示在剩余屏幕的问题

Influence:
1. 测试双屏扩展模式下拔掉主屏
2. 验证副屏上的窗口正确移动到剩余屏幕
3. 验证层表面(面板/任务栏)在拔屏后正确迁移
4. 测试拔屏后最大化/还原窗口功能
5. 验证复制模式不受此变更影响

Fixes: linuxdeepin#1
@deepin-wm deepin-wm force-pushed the fix/primary-hotunplug-migration branch from 87a225b to 9960e41 Compare June 18, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants