Skip to content

Conversation

@wineee
Copy link
Member

@wineee wineee commented Dec 30, 2025

Fixed a timing issue in Workspace::addSurface where surface initialization could occur before the container was properly set up. The issue was caused by calling model->addSurface(surface) before setting up the container, which could lead to layout operations on uninitialized surfaces.

Changes made:

  1. Reordered operations in Workspace::addSurface to set up SurfaceContainer before adding to model
  2. Added hasInitializeContainer() getter method and corresponding changed signal
  3. Added safety check in Output::addSurface to skip layout operations if container is not initialized
  4. Added connection to hasInitializeContainerChanged signal to trigger layout when container becomes available

Log: Fixed surface initialization timing issue

Influence:

  1. Test surface creation and initialization in various scenarios
  2. Verify that surfaces are properly laid out after container initialization
  3. Test with different surface types (layer surfaces, non-layer surfaces)
  4. Verify that prelaunch splash animations work correctly
  5. Test workspace switching with surfaces in different initialization states

fix: 修复 Workspace::addSurface 中的时序问题

修复了 Workspace::addSurface 中的时序问题,该问题导致表面初始
化可能在容器正确设置之前发生。问题是由于在设置容器之前调用了
model->addSurface(surface),可能导致对未初始化表面进行布局操作。

具体修改:

  1. 重新排序 Workspace::addSurface 中的操作,先设置 SurfaceContainer 再添 加到模型
  2. 添加 hasInitializeContainer() 获取方法和相应的变更信号
  3. 在 Output::addSurface 中添加安全检查,如果容器未初始化则跳过布局操作
  4. 添加对 hasInitializeContainerChanged 信号的连接,在容器可用时触发布局

Log: 修复表面初始化时序问题

Influence:

  1. 测试各种场景下的表面创建和初始化
  2. 验证表面在容器初始化后是否正确布局
  3. 测试不同类型的表面(层表面、非层表面)
  4. 验证预启动闪屏动画正常工作
  5. 测试工作区切换时不同初始化状态的表面

Issue: #670

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @wineee, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Fixed a timing issue in Workspace::addSurface where surface
initialization could occur before the container was properly set up. The
issue was caused by calling model->addSurface(surface) before setting
up the container, which could lead to layout operations on uninitialized
surfaces.

Changes made:
1. Reordered operations in Workspace::addSurface to set up
SurfaceContainer before adding to model
2. Added hasInitializeContainer() getter method and corresponding
changed signal
3. Added safety check in Output::addSurface to skip layout operations if
container is not initialized
4. Added connection to hasInitializeContainerChanged signal to trigger
layout when container becomes available

Log: Fixed surface initialization timing issue

Influence:
1. Test surface creation and initialization in various scenarios
2. Verify that surfaces are properly laid out after container
initialization
3. Test with different surface types (layer surfaces, non-layer
surfaces)
4. Verify that prelaunch splash animations work correctly
5. Test workspace switching with surfaces in different initialization
states

fix: 修复 Workspace::addSurface 中的时序问题

修复了 Workspace::addSurface 中的时序问题,该问题导致表面初始
化可能在容器正确设置之前发生。问题是由于在设置容器之前调用了
model->addSurface(surface),可能导致对未初始化表面进行布局操作。

具体修改:
1. 重新排序 Workspace::addSurface 中的操作,先设置 SurfaceContainer 再添
加到模型
2. 添加 hasInitializeContainer() 获取方法和相应的变更信号
3. 在 Output::addSurface 中添加安全检查,如果容器未初始化则跳过布局操作
4. 添加对 hasInitializeContainerChanged 信号的连接,在容器可用时触发布局

Log: 修复表面初始化时序问题

Influence:
1. 测试各种场景下的表面创建和初始化
2. 验证表面在容器初始化后是否正确布局
3. 测试不同类型的表面(层表面、非层表面)
4. 验证预启动闪屏动画正常工作
5. 测试工作区切换时不同初始化状态的表面

Issue: linuxdeepin#670
The previous implementation was calling arrangeAllSurfaces when a layer
surface was added or its properties changed, which was inefficient.
Since arrangeLayerSurfaces already handles arranging non-layer surfaces
when the exclusive zone changes, there's no need to call the more
expensive arrangeAllSurfaces function.

Changed the signal connection from layer properties changed to call
arrangeLayerSurfaces instead of arrangeAllSurfaces. Also updated
the immediate arrangement call after adding a layer surface to use
arrangeLayerSurfaces. This improves performance by avoiding unnecessary
arrangement of all surfaces when only layer surfaces need to be
rearranged.

Influence:
1. Test adding layer surfaces to ensure they are properly arranged
2. Verify that layer surface property changes trigger correct
rearrangement
3. Confirm that non-layer surfaces are still arranged when exclusive
zones change
4. Test overall surface arrangement behavior remains consistent
5. Monitor performance improvements in surface management

fix: 优化表面排列调用

之前的实现在添加层表面或其属性改变时调用arrangeAllSurfaces,这种做法效率
较低。由于arrangeLayerSurfaces在专属区域变化时已经会主动安排非层表面,因
此没有必要调用更昂贵的arrangeAllSurfaces函数。

将层属性改变的信号连接从调用arrangeAllSurfaces改为调用
arrangeLayerSurfaces。同时更新了添加层表面后的立即排列调用,使用
arrangeLayerSurfaces代替arrangeAllSurfaces。这通过避免在只需要重新排列层
表面时安排所有表面,提高了性能。

Influence:
1. 测试添加层表面以确保它们被正确排列
2. 验证层表面属性变化是否触发正确的重新排列
3. 确认当专属区域变化时非层表面仍然会被排列
4. 测试整体表面排列行为保持一致性
5. 监控表面管理中的性能改进
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wineee, zccrs

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

@wineee wineee mentioned this pull request Dec 30, 2025
16 tasks
@zccrs zccrs merged commit fbf4db0 into linuxdeepin:master Dec 30, 2025
9 of 11 checks passed
@wineee wineee deleted the fix-670 branch December 30, 2025 07:22
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.

3 participants