Skip to content

Conversation

@wineee
Copy link
Member

@wineee wineee commented Feb 10, 2026

Need: linuxdeepin/dde-application-manager#332

  1. Upgrade from treeland-prelaunch-splash-v1 to v2 protocol
  2. Add instanceId parameter to support multiple instances of same app
  3. Implement splash close notification when client crashes or closes early
  4. Add SplashResource class to manage individual splash instances
  5. Handle splash destruction requests from clients

Log: Added support for treeland_prelaunch_splash_manager_v2 protocol

Influence:

  1. Test prelaunch splash creation with appId and instanceId parameters
  2. Verify splash closes properly when client requests destruction
  3. Test multiple instances of same app with different instanceIds
  4. Verify cleanup when client crashes or closes unexpectedly
  5. Test backward compatibility with existing splash functionality

feat: 添加 prelaunch splash v2 协议支持

  1. 从 treeland-prelaunch-splash-v1 升级到 v2 协议
  2. 添加 instanceId 参数以支持同一应用的多个实例
  3. 实现客户端崩溃或提前关闭时的闪屏关闭通知
  4. 新增 SplashResource 类管理单个闪屏实例
  5. 处理客户端发起的闪屏销毁请求

Log: 新增 treeland_prelaunch_splash_manager_v2 协议支持

Influence:

  1. 测试使用 appId 和 instanceId 参数创建预启动闪屏
  2. 验证客户端请求销毁时闪屏正确关闭
  3. 测试同一应用多个实例使用不同 instanceId 的情况
  4. 验证客户端崩溃或意外关闭时的清理机制
  5. 测试与现有闪屏功能的向后兼容性

Summary by Sourcery

Migrate the prelaunch splash implementation to the treeland prelaunch splash v2 protocol and wire it through the compositor shell handling.

New Features:

  • Support the treeland_prelaunch_splash_manager_v2 protocol for creating prelaunch splash surfaces.
  • Track per-splash appId and instanceId via a dedicated SplashResource to allow multiple instances of the same app.
  • Notify the compositor when a client explicitly destroys its splash surface so the UI can clean up.

Enhancements:

  • Extend shell handling and helper wiring to pass instanceId through splash creation and to handle splash close notifications from clients.
  • Update build configuration to generate and link against the v2 prelaunch splash Wayland protocol definitions with a minimum TreelandProtocols version.

@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

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 10, 2026

Reviewer's Guide

Upgrades the prelaunch splash Wayland protocol integration from treeland-prelaunch-splash-v1 to v2, introduces per-splash resources keyed by appId and instanceId, wires the new instanceId through to shell handling (currently unused but plumbed), and adds handling for client-initiated splash destruction and close notifications, alongside the necessary CMake/protocol wiring changes.

Sequence diagram for prelaunch splash v2 creation flow

sequenceDiagram
    participant Client
    participant ManagerV2 as PrelaunchSplashPrivate
    participant SplashRes as SplashResource
    participant Prelaunch as PrelaunchSplash
    participant HelperObj as Helper
    participant Shell as ShellHandler
    participant RootContainer as RootSurfaceContainer

    Client->>ManagerV2: treeland_prelaunch_splash_manager_v2_create_splash(id, app_id, instance_id, sandboxEngineName, icon_buffer)
    ManagerV2->>ManagerV2: wl_resource_create(treeland_prelaunch_splash_v2_interface)
    ManagerV2->>SplashRes: create SplashResource(owner=PrelaunchSplash, resource, app_id, instance_id)
    ManagerV2->>Prelaunch: emit splashRequested(app_id, instance_id, qb)

    Prelaunch->>HelperObj: signal splashRequested
    HelperObj->>Shell: handlePrelaunchSplashRequested(appId, instanceId, iconBuffer)

    Shell->>Shell: check enablePrelaunchSplash and resolver
    Shell->>Shell: resolve app info (async)
    Shell->>Shell: createPrelaunchSplash(appId, instanceId, iconBuffer, lastSize, darkPalette, lightPalette, splashThemeType)
    Shell->>RootContainer: create prelaunch SurfaceWrapper and show splash
Loading

Sequence diagram for client-initiated prelaunch splash v2 close flow

sequenceDiagram
    participant Client
    participant SplashRes as SplashResource
    participant Prelaunch as PrelaunchSplash
    participant HelperObj as Helper
    participant Shell as ShellHandler
    participant RootContainer as RootSurfaceContainer

    Client->>SplashRes: treeland_prelaunch_splash_v2_destroy()
    SplashRes->>Prelaunch: emit splashCloseRequested(m_appId, m_instanceId)
    SplashRes->>SplashRes: wl_resource_destroy(handle)
    SplashRes->>SplashRes: destroy_resource self-destruct

    Prelaunch->>HelperObj: signal splashCloseRequested(appId, instanceId)
    HelperObj->>Shell: handlePrelaunchSplashClosed(appId, instanceId)

    Shell->>Shell: m_pendingPrelaunchAppIds.remove(appId)
    Shell->>Shell: find matching prelaunch wrapper by appId
    Shell->>RootContainer: destroyForSurface(wrapper)
    Shell->>Shell: remove wrapper from m_prelaunchWrappers
Loading

Class diagram for updated prelaunch splash v2 integration

classDiagram
    class PrelaunchSplash {
        +splashRequested(appId QString, instanceId QString, iconBuffer qw_buffer*)
        +splashCloseRequested(appId QString, instanceId QString)
        +create(server WServer*)
        +destroy(server WServer*)
        +global() wl_global*
        +interfaceName() QByteArrayView
    }

    class PrelaunchSplashPrivate {
        -q PrelaunchSplash*
        +PrelaunchSplashPrivate(q PrelaunchSplash*)
        +isGlobal() bool
        +init(display wl_display*, version int)
        +globalRemove()
        +treeland_prelaunch_splash_manager_v2_destroy(resource Resource*)
        +treeland_prelaunch_splash_manager_v2_create_splash(resource Resource*, id uint32_t, app_id QString, instance_id QString, sandboxEngineName QString, icon_buffer wl_resource*)
    }

    class SplashResource {
        -m_owner PrelaunchSplash*
        -m_appId QString
        -m_instanceId QString
        +SplashResource(owner PrelaunchSplash*, resource wl_resource*, appId QString, instanceId QString)
        +appId() QString
        +instanceId() QString
        +treeland_prelaunch_splash_v2_destroy(resource Resource*)
        +treeland_prelaunch_splash_v2_destroy_resource(resource Resource*)
    }

    class Helper {
        -m_prelaunchSplash PrelaunchSplash*
        -m_shellHandler ShellHandler*
        +init(treeland Treeland*)
    }

    class ShellHandler {
        -m_pendingPrelaunchAppIds QSet<QString>
        -m_prelaunchWrappers QList<SurfaceWrapper*>
        -m_rootSurfaceContainer RootSurfaceContainer*
        +handlePrelaunchSplashRequested(appId QString, instanceId QString, iconBuffer qw_buffer*)
        +createPrelaunchSplash(appId QString, instanceId QString, iconBuffer qw_buffer*, lastSize QSize, darkPalette QString, lightPalette QString, splashThemeType qlonglong)
        +handlePrelaunchSplashClosed(appId QString, instanceId QString)
    }

    PrelaunchSplashPrivate --> PrelaunchSplash : owner
    SplashResource --> PrelaunchSplash : m_owner
    PrelaunchSplash --> PrelaunchSplashPrivate : has
    Helper --> PrelaunchSplash : holds_pointer
    Helper --> ShellHandler : holds_pointer
    ShellHandler --> SurfaceWrapper : manages
    ShellHandler --> RootSurfaceContainer : uses
    PrelaunchSplash --> ShellHandler : signals_via_Helper
Loading

File-Level Changes

Change Details Files
Upgrade PrelaunchSplash Wayland protocol implementation from v1 manager-only API to v2 with per-splash resources and instanceId support.
  • Switch includes, interface name, and global version from treeland-prelaunch-splash-v1 to treeland-prelaunch-splash-v2.
  • Change PrelaunchSplashPrivate to inherit from treeland_prelaunch_splash_manager_v2 and update destroy/create_splash handler signatures to the v2 protocol (id and instance_id parameters).
  • Create wl_resources for each splash in create_splash and wrap them in a new SplashResource helper that stores appId and instanceId, emits close requests, and self-destructs on destroy_resource.
  • Emit splashRequested with appId, instanceId, and icon buffer instead of only appId and buffer.
  • Update logging messages to indicate v2 global creation/removal.
src/modules/prelaunch-splash/prelaunchsplash.cpp
src/modules/prelaunch-splash/prelaunchsplash.h
Introduce ShellHandler plumbing for instanceId and splash close handling while keeping instanceId unused in layout logic for now.
  • Extend ShellHandler::handlePrelaunchSplashRequested and createPrelaunchSplash to accept instanceId, and propagate it from the PrelaunchSplash::splashRequested signal, marking it unused with Q_UNUSED for now.
  • Add ShellHandler::handlePrelaunchSplashClosed to respond to splashCloseRequested by removing pending prelaunch entries and destroying any existing prelaunch wrapper with the matching appId.
  • Wire the new slots into shellhandler.h and connect them from Helper via the PrelaunchSplash signals.
src/core/shellhandler.cpp
src/core/shellhandler.h
src/seat/helper.cpp
Update build system to use the v2 prelaunch splash protocol definition and required TreelandProtocols version.
  • Require TreelandProtocols version 0.5.5 in CMake for the prelaunch-splash module.
  • Swap the generated Wayland protocol sources from treeland-prelaunch-splash-v1 to treeland-prelaunch-splash-v2 in local_qtwayland_server_protocol_treeland and impl_treeland calls.
src/modules/prelaunch-splash/CMakeLists.txt

Possibly linked issues

  • #N/A: PR’s v2 protocol adds instanceId and crash/close-driven splash closing, matching the issue’s abnormal-exit splash closing task.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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 migrates Treeland’s prelaunch splash support from treeland-prelaunch-splash-v1 to the v2 protocol, wiring the new instanceId parameter through the compositor and adding a close-notification path so the shell can clean up splash UI when clients request destruction.

本 PR 将 Treeland 的预启动闪屏协议从 treeland-prelaunch-splash-v1 迁移到 v2,并将新增的 instanceId 参数贯穿到合成器侧,同时增加“关闭通知”路径,以便客户端请求销毁时 shell 能清理闪屏 UI。

Changes:

  • Switch protocol build/gen from v1 to v2 and require TreelandProtocols >= 0.5.5.
  • Implement v2 manager + per-splash SplashResource and emit close requests on client destruction.
  • Update Helper/ShellHandler wiring to accept instanceId and handle close notifications.

变更点:

  • 将协议构建/生成从 v1 切换为 v2,并要求 TreelandProtocols >= 0.5.5
  • 实现 v2 manager 与按闪屏实例划分的 SplashResource,并在客户端销毁时发出关闭请求信号。
  • 更新 Helper/ShellHandler 的信号/槽连接以接收 instanceId 并处理关闭通知。

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/seat/helper.cpp Updates signal/slot wiring to pass instanceId and forward close notifications. / 更新信号连接,传递 instanceId 并转发关闭通知。
src/modules/prelaunch-splash/prelaunchsplash.h Extends signals to include instanceId and adds splashCloseRequested. / 扩展信号,加入 instanceId 并新增 splashCloseRequested
src/modules/prelaunch-splash/prelaunchsplash.cpp Migrates to v2 protocol implementation and introduces SplashResource for per-instance lifecycle. / 迁移至 v2 协议实现,并引入 SplashResource 管理单实例生命周期。
src/modules/prelaunch-splash/CMakeLists.txt Generates/links v2 protocol code and bumps TreelandProtocols minimum version. / 生成并链接 v2 协议代码,同时提升 TreelandProtocols 最低版本要求。
src/core/shellhandler.h Updates handler APIs to accept instanceId and adds close handler declaration. / 更新处理接口以接收 instanceId,并声明关闭处理函数。
src/core/shellhandler.cpp Plumbs instanceId through request/creation flow and implements close cleanup hook. / 将 instanceId 接入请求/创建流程,并实现关闭清理入口。

Comment on lines 42 to 47
void treeland_prelaunch_splash_v2_destroy(Resource *resource) override
{
qCInfo(prelaunchSplash)
<< "Client destroy splash appId=" << m_appId << " instanceId=" << m_instanceId;
Q_EMIT m_owner->splashCloseRequested(m_appId, m_instanceId);
wl_resource_destroy(resource->handle);
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

SplashResource only emits splashCloseRequested from the explicit destroy request handler. If the client crashes/disconnects (or the resource is destroyed for any other reason), treeland_prelaunch_splash_v2_destroy_resource currently just deletes the object and no close notification is emitted, so the compositor UI may leak a splash wrapper. Emit the close notification from *_destroy_resource as well, and ensure it is emitted only once (e.g., emit only in *_destroy_resource, or add a guard flag to prevent double-emission when destroy calls wl_resource_destroy).

SplashResource 仅在客户端显式调用 destroy 请求时发出 splashCloseRequested。如果客户端崩溃/断开连接(或资源因其他原因被销毁),treeland_prelaunch_splash_v2_destroy_resource 目前只会 delete 对象,不会发出关闭通知,可能导致合成器侧闪屏 wrapper 泄漏。建议也在 *_destroy_resource 中发出关闭通知,并确保只发出一次(例如只在 *_destroy_resource 中发出,或增加标志位避免 destroy -> wl_resource_destroy 导致重复发出)。

Copilot uses AI. Check for mistakes.
Comment on lines +1 to 6
find_package(TreelandProtocols 0.5.5 REQUIRED)

local_qtwayland_server_protocol_treeland(libtreeland
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-prelaunch-splash-v1.xml
BASENAME treeland-prelaunch-splash-v1
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-prelaunch-splash-v2.xml
BASENAME treeland-prelaunch-splash-v2
)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The repo has QtTest-based protocol smoke tests under tests/test_protocol_*, but there is no coverage added for the new treeland-prelaunch-splash-v2 protocol. Add a small test_protocol_prelaunch-splash that at least attaches the PrelaunchSplash interface and exercises the close-notification path (explicit destroy + client disconnect) to prevent regressions.

仓库里已有基于 QtTest 的协议冒烟测试(tests/test_protocol_*),但此次新增/升级的 treeland-prelaunch-splash-v2 协议没有对应测试覆盖。建议新增一个 test_protocol_prelaunch-splash:至少验证 PrelaunchSplash 能 attach 成功,并覆盖关闭通知路径(显式 destroy + 客户端断开)以避免回归。

Copilot uses AI. Check for mistakes.
1. Upgrade from treeland-prelaunch-splash-v1 to v2 protocol
2. Add instanceId parameter to support multiple instances of same app
3. Implement splash close notification when client crashes or closes
early
4. Add SplashResource class to manage individual splash instances
5. Handle splash destruction requests from clients

Log: Added support for treeland_prelaunch_splash_manager_v2 protocol

Influence:
1. Test prelaunch splash creation with appId and instanceId parameters
2. Verify splash closes properly when client requests destruction
3. Test multiple instances of same app with different instanceIds
4. Verify cleanup when client crashes or closes unexpectedly
5. Test backward compatibility with existing splash functionality

feat: 添加 prelaunch splash v2 协议支持

1. 从 treeland-prelaunch-splash-v1 升级到 v2 协议
2. 添加 instanceId 参数以支持同一应用的多个实例
3. 实现客户端崩溃或提前关闭时的闪屏关闭通知
4. 新增 SplashResource 类管理单个闪屏实例
5. 处理客户端发起的闪屏销毁请求

Log: 新增 treeland_prelaunch_splash_manager_v2 协议支持

Influence:
1. 测试使用 appId 和 instanceId 参数创建预启动闪屏
2. 验证客户端请求销毁时闪屏正确关闭
3. 测试同一应用多个实例使用不同 instanceId 的情况
4. 验证客户端崩溃或意外关闭时的清理机制
5. 测试与现有闪屏功能的向后兼容性
Added new test suite for prelaunch splash protocol functionality
1. Created new test directory test_protocol_prelaunch-splash
2. Implemented Qt test framework with CMake configuration
3. Added test cases for protocol creation and signal verification
4. Set up offscreen testing environment with 3-second timeout
5. Tests verify PrelaunchSplash protocol attachment to server
6. Validates splashRequested and splashCloseRequested signals

This test ensures the prelaunch splash protocol works correctly with
the Wayland server integration and provides automated validation for the
splash screen functionality.

Influence:
1. Run the new test executable to verify prelaunch splash protocol
2. Check test results for protocol attachment and signal functionality
3. Verify no regressions in existing protocol tests
4. Confirm test timeout behavior with 3-second limit
5. Validate offscreen rendering environment setup

feat: 添加预启动闪屏协议测试

新增预启动闪屏协议功能的测试套件
1. 创建新的测试目录 test_protocol_prelaunch-splash
2. 使用 CMake 配置实现 Qt 测试框架
3. 添加协议创建和信号验证的测试用例
4. 设置离屏测试环境,超时时间为3秒
5. 测试验证 PrelaunchSplash 协议正确附加到服务器
6. 验证 splashRequested 和 splashCloseRequested 信号

该测试确保预启动闪屏协议与 Wayland 服务器集成正常工作,并为闪屏功能提供
自动化验证。

Influence:
1. 运行新的测试可执行文件验证预启动闪屏协议
2. 检查测试结果,确认协议附加和信号功能正常
3. 验证现有协议测试无回归问题
4. 确认3秒超时限制的测试行为
5. 验证离屏渲染环境设置正确
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