Skip to content

Conversation

@wineee
Copy link
Member

@wineee wineee commented Jan 27, 2026

This pull request introduces a new application-level configuration for storing window and theme preferences, and refactors how window state and splash theme settings are managed. It also improves the splash screen theming, making it configurable and consistent with user preferences. The changes are grouped into configuration enhancements, splash screen improvements, and codebase refactoring.

Configuration enhancements:

  • Added a new application config file (org.deepin.dde.treeland.app.json) to store window size, theme preference, and singleton app status, and updated the build system to generate corresponding C++ config classes. [1] [2] [3] [4]
  • Extended user config (org.deepin.dde.treeland.user.json) to include splash screen theme type and palette colors.

Splash screen improvements:

  • Made the splash screen background color configurable and theme-aware, passing the color from C++ to QML and using user/app config to resolve the correct palette. [1] [2] [3] [4] [5] [6]
  • Ensured that splash screens are only created after configuration is initialized and that pending requests are tracked and resolved correctly. [1] [2]

Codebase refactoring:

  • Replaced WindowSizeStore with a more general WindowConfigStore for managing window state and configuration, updating all usages accordingly. [1] [2] [3] [4] [5] [6] [7]
  • Improved pending splash and wrapper management to avoid race conditions when windows are created/destroyed, and to ensure state consistency. [1] [2] [3]

These changes collectively enhance configuration flexibility, improve the user experience around splash screens, and make the codebase more maintainable.

Summary by Sourcery

Introduce an application-level window configuration store and use it to drive theme-aware, configurable splash screens while improving prelaunch splash lifecycle handling.

New Features:

  • Add a dconfig-backed application config (AppConfig) for per-app window state and theme preferences.
  • Make prelaunch splash background color configurable and aligned with user and app theme settings.

Enhancements:

  • Replace the window size store with a generalized window configuration store that persists window sizes and theme type per app and supports async initialization.
  • Ensure prelaunch splash screens are only created after configuration is ready and are cancelled when a real window appears to avoid inconsistent state.
  • Propagate splash background color from C++ into QML and through SurfaceWrapper/QmlEngine to centralize splash appearance control.

Build:

  • Generate AppConfig C++ bindings from the new org.deepin.dde.treeland.app.json dconfig file and include them in the libtreeland build.

Chores:

  • Install the new org.deepin.dde.treeland.app.json configuration file alongside existing dconfig files.

1. Replace QSettings-based window size storage with dconfig for better
integration with deepin ecosystem
2. Add new app-specific dconfig file with window size and theme
preferences
3. Implement WindowSizeStore class using dconfig API with per-app
configuration instances
4. Add configuration for window dimensions, theme type, and singleton
app flag

Log: Window size storage now uses dconfig instead of QSettings

Influence:
1. Test window size persistence across application restarts
2. Verify theme preference settings work correctly
3. Check singleton app behavior with multiple launches
4. Validate configuration access permissions and visibility
5. Test with different applications to ensure per-app isolation
6. Verify backward compatibility with existing window size data

feat: 将窗口大小存储迁移至 dconfig

1. 使用 dconfig 替换基于 QSettings 的窗口大小存储,更好地集成到 deepin
生态
2. 新增应用特定的 dconfig 文件,包含窗口大小和主题偏好设置
3. 使用 dconfig API 实现 WindowSizeStore 类,支持每个应用的配置实例
4. 添加窗口尺寸、主题类型和单例应用标记的配置项

Log: 窗口大小存储现在使用 dconfig 替代 QSettings

Influence:
1. 测试应用重启后窗口大小的持久化功能
2. 验证主题偏好设置是否正确工作
3. 检查单例应用在多启动时的行为
4. 验证配置访问权限和可见性设置
5. 使用不同应用测试确保每个应用的配置隔离
6. 验证与现有窗口大小数据的向后兼容性
Updated default window dimensions from 1280x720 to 800x600 for better
usability on smaller screens. Added comprehensive splash screen
theme system with dark/light theme support, including configurable
color palettes. Enhanced PrelaunchSplash component to accept dynamic
background colors based on theme preferences. Extended WindowSizeStore
to manage per-application theme settings.

Log: Added splash screen theme customization with dark/light modes

Influence:
1. Test application launch with different theme settings
2. Verify splash screen displays correct colors for dark/light themes
3. Check window size defaults to 800x600 for new applications
4. Test theme persistence across application restarts
5. Verify splash screen radius and animation remain consistent
6. Test with various application icons and window sizes

feat: 添加闪屏主题支持并调整默认窗口大小

将默认窗口尺寸从1280x720调整为800x600,提升在小屏幕上的使用体验。
新增完整的闪屏主题系统,支持暗色/亮色主题,包含可配置的调色板。增强
PrelaunchSplash组件以支持基于主题偏好的动态背景色。扩展WindowSizeStore以
管理每个应用程序的主题设置。

Log: 新增闪屏主题自定义功能,支持暗色/亮色模式

Influence:
1. 测试不同主题设置下的应用程序启动
2. 验证闪屏在暗色/亮色主题下显示正确的颜色
3. 检查新应用程序的窗口大小默认是否为800x600
4. 测试主题设置在应用程序重启后的持久性
5. 验证闪屏圆角和动画保持一致性
6. 测试不同应用程序图标和窗口大小的情况
The previous implementation directly accessed dconfig for window size
during prelaunch splash creation, which could fail when dconfig was
still initializing asynchronously. This caused incorrect splash sizes or
missing size restoration.

Changes:
1. Added pending prelaunch app tracking to handle dconfig initialization
delays
2. Implemented async callback mechanism for window size retrieval
3. Modified WindowSizeStore to provide size via callback when dconfig
is ready
4. Added proper dconfig initialization state handling
5. Enhanced logging for debugging dconfig initialization flow

Log: Fixed incorrect splash window size when apps launch quickly after
system startup

Influence:
1. Test app launching immediately after system startup
2. Verify splash windows restore correct previous sizes
3. Test multiple apps launching simultaneously
4. Check behavior when dconfig initialization fails
5. Verify splash timeout mechanism still works correctly
6. Test with apps that have no previous window size stored

fix: 修复 dconfig 异步初始化导致闪屏大小不正确的问题

先前实现在创建预启动闪屏时直接访问 dconfig 获取窗口大小,但当 dconfig 仍
在异步初始化时可能会失败,导致闪屏大小不正确或无法恢复之前的大小。

修改内容:
1. 添加待处理预启动应用跟踪以处理 dconfig 初始化延迟
2. 实现异步回调机制用于窗口大小获取
3. 修改 WindowSizeStore 以在 dconfig 就绪时通过回调提供大小
4. 添加正确的 dconfig 初始化状态处理
5. 增强日志记录用于调试 dconfig 初始化流程

Log: 修复系统启动后快速启动应用时闪屏窗口大小不正确的问题

Influence:
1. 测试系统启动后立即启动应用的情况
2. 验证闪屏窗口是否正确恢复之前的大小
3. 测试多个应用同时启动的情况
4. 检查 dconfig 初始化失败时的行为
5. 验证闪屏超时机制是否仍正常工作
6. 测试没有存储之前窗口大小的应用
Renamed WindowSizeStore class to WindowConfigStore to better reflect
its expanded functionality beyond just window size management. The class
now handles multiple window configuration properties including theme
type settings. Updated all references in CMakeLists.txt, header files,
and implementation files to use the new name. This change improves code
clarity and prepares for future configuration extensions.

The refactor maintains all existing functionality while making the class
name more descriptive of its actual capabilities. The class continues
to manage window size persistence through dconfig but now also handles
theme configuration, making "WindowConfigStore" a more appropriate name.

Influence:
1. Verify window size persistence still works correctly for applications
2. Test theme type configuration functionality if available
3. Check that all window management operations continue to function
normally
4. Ensure no regression in window sizing behavior
5. Confirm application configuration storage remains intact

refactor: 将 WindowSizeStore 重命名为 WindowConfigStore

将 WindowSizeStore 类重命名为 WindowConfigStore,以更好地反映其超越窗口
大小管理的扩展功能。该类现在处理多个窗口配置属性,包括主题类型设置。更新
了 CMakeLists.txt、头文件和实现文件中的所有引用以使用新名称。此更改提高
了代码清晰度,并为未来的配置扩展做好准备。

重构保持了所有现有功能,同时使类名更符合其实际能力。该类继续通过 dconfig
管理窗口大小持久化,但现在也处理主题配置,使得"WindowConfigStore"成为更
合适的名称。

Influence:
1. 验证应用程序的窗口大小持久化功能是否仍然正常工作
2. 测试主题类型配置功能(如果可用)
3. 检查所有窗口管理操作是否继续正常运行
4. 确保窗口大小调整行为没有回归问题
5. 确认应用程序配置存储保持完整
Added support for dark/light theme color customization for splash
screens. The implementation includes:
1. Added theme type parameter to window config callback to pass app-
specific theme preference
2. Implemented color resolution logic that uses user-configured dark/
light palette colors
3. Removed hardcoded dark theme forcing and uses system/configured theme
colors
4. Added QColor include and user config dependency for color handling

Log: Splash screens now respect user-configured dark/light theme colors

Influence:
1. Test splash screen appearance with different theme settings (system/
dark/light)
2. Verify color customization works through user configuration
3. Test app-specific theme preferences override system settings
4. Verify fallback colors work when custom colors are not configured
5. Test splash screen behavior during app prelaunch and window creation

feat: 添加闪屏主题颜色自定义支持

新增对闪屏暗色/亮色主题颜色自定义的支持。实现包括:
1. 为窗口配置回调添加主题类型参数以传递应用特定的主题偏好
2. 实现颜色解析逻辑,使用用户配置的暗色/亮色调色板颜色
3. 移除硬编码的暗色主题强制,使用系统/配置的主题颜色
4. 添加QColor包含和用户配置依赖以支持颜色处理

Log: 闪屏现在支持用户配置的暗色/亮色主题颜色

Influence:
1. 测试不同主题设置(系统/暗色/亮色)下的闪屏外观
2. 验证通过用户配置的颜色自定义功能正常工作
3. 测试应用特定主题偏好是否覆盖系统设置
4. 验证当未配置自定义颜色时回退颜色是否正常工作
5. 测试应用预启动和窗口创建过程中的闪屏行为
@deepin-ci-robot
Copy link

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wineee

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the splash screen experience by making it theme-aware and introduces a more flexible configuration system for window state and preferences. The changes replace the basic WindowSizeStore with a more robust WindowConfigStore backed by dconfig, implement configurable splash screen theming, and improve pending splash request handling to avoid race conditions.

Changes:

  • Introduced app-level configuration (org.deepin.dde.treeland.app.json) for per-app window size and theme preferences
  • Extended user configuration with splash screen theme settings and palette colors
  • Refactored window state management from WindowSizeStore to WindowConfigStore with async dconfig initialization support
  • Made splash screen background color configurable and theme-aware, with proper color resolution based on per-app or system theme preferences
  • Improved pending splash management to prevent race conditions when windows are created during dconfig initialization

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/surface/surfacewrapper.h Added backgroundColor parameter to splash screen constructor
src/surface/surfacewrapper.cpp Propagated backgroundColor through constructors and retrieved it from prelaunch splash properties
src/core/windowsizestore.h Removed old QSettings-based window size store
src/core/windowconfigstore.h Added new dconfig-backed configuration store with async initialization support
src/core/windowconfigstore.cpp Implemented WindowConfigStore with per-app dconfig instances and async callbacks
src/core/shellhandler.h Updated to use WindowConfigStore and added pending prelaunch app ID tracking
src/core/shellhandler.cpp Implemented splash color resolution logic and pending request management to avoid race conditions
src/core/qmlengine.h Added backgroundColor parameter to createPrelaunchSplash API
src/core/qmlengine.cpp Passed backgroundColor to QML component creation
src/core/qml/PrelaunchSplash.qml Made background color configurable via property binding
src/CMakeLists.txt Added app config generation to build system
misc/dconfig/org.deepin.dde.treeland.user.json Added splash theme type and palette color configurations
misc/dconfig/org.deepin.dde.treeland.app.json Created new per-app configuration schema
misc/dconfig/CMakeLists.txt Added app config to installation

Added enablePrelaunchSplash dconfig option to allow disabling prelaunch
splash screen for individual applications
Modified WindowConfigStore to handle the new configuration parameter and
pass it to splash creation logic
Updated callback signatures to include prelaunch splash enabled status
Added proper logging with debug and warning levels for configuration
operations
Enhanced QmlEngine interface to require explicit parameters for splash
creation

Log: Added per-application prelaunch splash screen configuration option

Influence:
1. Test application launch with prelaunch splash enabled/disabled via
dconfig
2. Verify splash screen behavior for apps with different configurations
3. Test configuration changes while applications are running
4. Verify logging output for configuration operations
5. Check that existing window size and theme configurations remain
functional

feat: 添加应用级预启动闪屏配置

新增 enablePrelaunchSplash dconfig 选项,支持为单个应用禁用预启动闪屏
修改 WindowConfigStore 以处理新的配置参数并传递给闪屏创建逻辑
更新回调函数签名以包含预启动闪屏启用状态
为配置操作添加适当的调试和警告级别日志记录
增强 QmlEngine 接口,要求显式参数用于闪屏创建

Log: 新增应用级预启动闪屏配置选项

Influence:
1. 测试通过 dconfig 启用/禁用预启动闪屏时的应用启动行为
2. 验证不同配置下应用的闪屏显示行为
3. 测试应用运行时更改配置的效果
4. 验证配置操作的日志输出
5. 检查现有的窗口大小和主题配置功能是否正常
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Refactored the splash screen configuration handling to improve code
clarity and maintainability. Key changes include:
1. Renamed "themeType" to "splashThemeType" in dconfig to better reflect
its purpose
2. Simplified splash color resolution logic by removing redundant lambda
function
3. Replaced withLastSizeFor with withSplashConfigFor that provides a
more focused callback interface
4. Added proper error handling with skipCallback for failed config
initialization
5. Improved code organization by removing unused theme management
functions
6. Added safety checks with QPointer to prevent use-after-free scenarios
7. Enhanced logging with better warning messages for configuration
issues

Log: Improved splash screen configuration handling and error management

Influence:
1. Test splash screen appearance with different theme settings (follow
system/dark/light)
2. Verify splash screen timeout behavior with various timeout values
3. Test splash screen display when dconfig initialization fails
4. Validate splash color rendering for both dark and light themes
5. Check splash screen size restoration from previous sessions
6. Test prelaunch splash enable/disable functionality

refactor: 清理闪屏 dconfig 相关代码逻辑

重构了闪屏配置处理逻辑以提高代码清晰度和可维护性。主要变更包括:
1. 将 dconfig 中的 "themeType" 重命名为 "splashThemeType" 以更好反映其
用途
2. 通过移除冗余的 lambda 函数简化了闪屏颜色解析逻辑
3. 用 withSplashConfigFor 替换 withLastSizeFor,提供更专注的回调接口
4. 添加了适当的错误处理,使用 skipCallback 处理配置初始化失败情况
5. 通过移除未使用的主题管理函数改进了代码组织
6. 使用 QPointer 添加安全检查以防止释放后使用场景
7. 通过更好的配置问题警告消息增强了日志记录

Log: 改进了闪屏配置处理和错误管理
Add buffer locking mechanism to prevent iconBuffer from being destructed
while waiting for dconfig initialization. The iconBuffer parameter in
handlePrelaunchSplashRequested is passed by value and could be destroyed
during async config loading, causing use-after-free issues.

Log: Fixed potential crash during application splash screen
initialization

fix: 防止dconfig初始化过程中iconBuffer被析构

添加缓冲区锁定机制,防止在等待dconfig初始化时iconBuffer被析构。
handlePrelaunchSplashRequested中的iconBuffer参数按值传递,在异步配置加载
过程中可能被销毁,导致use-after-free问题。
@wineee wineee requested a review from Copilot January 28, 2026 07:12
@wineee wineee marked this pull request as ready for review January 28, 2026 07:13
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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

"permissions": "readwrite",
"visibility": "public"
},
"splashThemeType": {
Copy link
Member

Choose a reason for hiding this comment

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

这个有啥用,不是app里已经有了吗,还需要一个全局的吗

Copy link
Member

Choose a reason for hiding this comment

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

陈对user的不如推出一个splashEnabled的开关,能用来把某个账户下的所有闪屏都关闭掉。

Copy link
Member Author

@wineee wineee Jan 28, 2026

Choose a reason for hiding this comment

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

app的有暗色,亮色和跟随全局(user)的选项

Copy link
Member Author

Choose a reason for hiding this comment

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

把 splashEnabled 从 treeland gloabel 移到 user 吗?现在有全局(gloabel)和单应用可以配置 enable

"permissions": "readwrite",
"visibility": "public"
},
"splashDarkPalette": {
Copy link
Member

Choose a reason for hiding this comment

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

应该交给app设置,而不是跟user相关。

"permissions": "readwrite",
"visibility": "public"
},
"splashLightPalette": {
Copy link
Member

Choose a reason for hiding this comment

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

同上

return;
m_pendingPrelaunchAppIds.insert(appId);

auto createSplash = [this, appId, iconBuffer](const QSize &lastSize,
Copy link
Member

Choose a reason for hiding this comment

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

这里有必要用lambda吗?没必要的话就做成一个成员函数,lambda在调试时很难受,函数名太奇葩了,在崩溃栈里也很难看。

Copy link
Member Author

Choose a reason for hiding this comment

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

主要是捕获 appId, iconBuffer, 成员函数需要手动管理

This commit applies clang-format to multiple source files to enforce
consistent code formatting style across the codebase.

本次提交对多个源文件应用 clang-format 以强制执行一致的代码格式化风格
1. Fix icon buffer memory leak by properly unlocking the buffer when
splash creation is skipped
2. Add validation for window size configuration to prevent invalid QSize
objects
3. Reorder operations to ensure proper cleanup before early returns

Log: Fixed potential memory leak in splash screen handling and improved
window size validation
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