Skip to content

refactor(dde-shell): remove deprecated dde-shell-v1 implementation - #1720

Draft
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/bot/e33f32c2b2cd
Draft

deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/bot/e33f32c2b2cd

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

treeland-dde-shell-v1 is deprecated and clients have already moved to treeland-dde-shell-unstable-v2, so the compositor side implementation is dead code. This removes it together with everything that only existed to serve it.

Changes

Protocol implementation and registration:

  • delete src/modules/dde-shell/ddeshellmanagerinterfacev1.{h,cpp} and ddeshellattached.{h,cpp}
  • drop the v1 protocol generation and source entries from src/modules/dde-shell/CMakeLists.txt
  • remove m_ddeShellV1, the v1 attach, and the lockScreenCreated / toggleMultitaskview connections from WaylandServer, along with the DDEShellHelper QML registration

Call sites that became dead code:

  • ShellHandler: remove handleDdeShellSurfaceAdded() and the v1 branches in ensureXdgWrapper() / onXdgToplevelSurfaceRemoved()
  • CompositorInputFilter, DragController (initialize(bool) -> initialize(), callers updated): drop the v1 notifications
  • WindowOverlapChecker creation removed
  • LockScreenManager: remove handleLockScreen() / onLockScreenShutdown() and the v1 lock screen resource handling; the replacements (treeland_compositor_action_v1, action_toggle_multitask_view, treeland-active-notify-unstable-v1, region-watch) are already in place

ShellHandler::updateSurfaceAcceptKeyboardFocus() is kept and reused by both v2 call sites, so it is not left as dead code.

tests/protocols/INDEX.md is updated accordingly.

Verification

Against current master (be61b3737):

  • cmake --preset ci (CI's -Wall -Wextra -Werror) configure OK, cmake --build build --parallel exit 0
  • ctest -L protocols: 73/73 passed, 0 failed
  • repo-wide grep for dde-shell-v1 / DDEShellSurfaceInterface / DDEShellHelper / WindowOverlapChecker / DDEShellManagerInterfaceV1 / LockScreenInterface: no hits outside debian/changelog and the historical README release notes

Not covered: no real compositor session run (no seat / DRM in this environment), and the activation/focus cleanup after accept_keyboard_focus=false still has no automated test.

Depends on the protocol package change: linuxdeepin/treeland-protocols#146.

Summary by Sourcery

Remove the deprecated dde-shell-v1 compositor support and clean up its obsolete integrations while consolidating behavior on dde-shell v2 and replacement protocols.

Bug Fixes:

  • Ensure dde-shell v2 keyboard-focus changes also remove surfaces that are already active or focused when focus is denied.

Enhancements:

  • Remove the deprecated treeland-dde-shell-v1 compositor implementation, registration, protocol generation, and dependent call paths.
  • Simplify drag initialization and input notifications now that v1-specific activity reporting is no longer required.
  • Remove obsolete v1 lock-screen integration and window-overlap checker creation while retaining the replacement protocols and v2 shell support.

Build:

  • Stop generating and compiling the deprecated treeland-dde-shell-v1 protocol and its implementation sources.

Documentation:

  • Update the protocol coverage index to remove the deleted dde-shell-v1 protocol.

The treeland-dde-shell-v1 protocol is deprecated and dde-shell has
migrated to treeland-dde-shell-unstable-v2, so drop the whole v1
implementation instead of keeping it for a transition period:

- delete ddeshellmanagerinterfacev1.* and ddeshellattached.*, and the
  v1 protocol generation plus sources from the module CMakeLists
- drop the v1 shell-surface path in ShellHandler; v2 already carries
  role, placement hints, skip flags and accept_keyboard_focus
- drop the v1 per-surface/seat notifications from CompositorInputFilter
  and DragController; treeland-active-notify-unstable-v1 already
  reports the same activity and drag state
- drop WindowOverlapChecker creation; treeland-region-watch-unstable-v1
  covers the overlap checking
- drop the v1 lockscreen resource handling; lock/shutdown/switch-user
  are triggered through treeland_compositor_action_v1
- drop the multitaskview toggle and the DDEShellHelper QML registration

No behavior changes for v2 clients: the deleted v1 pieces have v2 or
dedicated-protocol replacements for every request dde-shell uses.
Review follow-up for removing the v1 protocol: dropping the v1 path left
ShellHandler::updateSurfaceAcceptKeyboardFocus() with no caller, and the
v2 path only flipped the focus capability bit, so a dde-shell surface
that set accept_keyboard_focus=false after being activated stayed in the
activation history and could keep keyboard focus - the exact case the v1
helper handled.

Route both v2 call sites through the helper (same behaviour v1 shipped
with) instead of keeping a dead function.
@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

@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

API

Remove the deprecated v1 dde-shell protocol interfaces and their implementation together, since no compositor-side v1 API remains.

  • src/modules/dde-shell/ddeshellattached.cpp (deleted)
  • src/modules/dde-shell/ddeshellattached.h (deleted)
  • src/modules/dde-shell/ddeshellmanagerinterfacev1.cpp (deleted)
  • src/modules/dde-shell/ddeshellmanagerinterfacev1.h (deleted)

Uses of the API

Stop registering or invoking v1-only protocol resources and notifications, relying on the dedicated compositor-action and active-notify protocols instead.

  • src/core/waylandserver.cpp L33-1294 (5 small edits)
  • src/core/surfaceprotocolcontroller.cpp L24 (removed lines), L313 (removed lines)
  • src/core/waylandserver.h L104 (removed lines), L114 (removed lines), L473 (removed lines)
  • src/input/compositorinputfilter.cpp L18-367 (5 small edits)

Implementation

Remove the v1 shell-surface handling and cleanup while keeping the v2 focus-update path responsible for clearing activation when focus is refused.

  • src/core/shellhandler.cpp L1251-1259 (+6 small edits)
  • src/core/shellhandler.h L152 (removed lines)

Simplify drag-controller initialization and drop its v1-specific drag notifications while retaining active-notify reporting.

  • src/seat/dragcontroller.cpp L6-96 (5 small edits)
  • src/seat/dragcontroller.h L32, L44 (removed lines)

Remove the legacy lock-screen resource callbacks now that lock, shutdown, and switch-user actions use the compositor-action protocol.

  • src/lockscreen/lockscreenmanager.cpp L11 (removed lines), L104 (removed lines), L239 (removed lines)
  • src/lockscreen/lockscreenmanager.h L15 (removed lines), L36 (removed lines), L52 (removed lines)

Configuration

Stop generating and compiling the deprecated v1 protocol sources in the dde-shell module.

  • src/modules/dde-shell/CMakeLists.txt L3 (removed lines), L12 (removed lines)

Documentation

Update the protocol coverage index to remove the deleted dde-shell-v1 entry and its obsolete coverage caveat.

  • tests/protocols/INDEX.md L152, L159 (removed lines)

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

@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.

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/lockscreen/lockscreenmanager.cpp" line_range="112" />
<code_context>
-        if (m_server->isNormalOrMultitaskview())
-            showLockScreen(false);
-    });
-    connect(lockScreen, &LockScreenInterface::switchUser, this, &LockScreenManager::showSwitchUser);
-}
-
</code_context>
<issue_to_address>
**Locked-screen user switching stops working**

When the lock-screen UI requests user switching while the compositor is in `CurrentMode::LockScreen`, `ShellActionExecutor::execute()` returns immediately in `CurrentMode::LockScreen`, so the replacement `action_show_user_switch` never reaches `WaylandServer::showSwitchUser()`; removing the direct `LockScreenInterface::switchUser` connection leaves the lock-screen UI unable to request a user switch.

Allow the user-switch action in lock-screen mode, or preserve a dedicated lock-screen request path for it.
</issue_to_address>

### Comment 2
<location path="src/core/shellhandler.cpp" line_range="1254" />
<code_context>
+    // Refusing keyboard focus must also drop a surface that was already
+    // activated/focused, not just flip the capability bit: dde-shell sets the
+    // property after the surface is mapped and often activated.
+    updateSurfaceAcceptKeyboardFocus(wrapper, shellSurface->acceptKeyboardFocus());
     connect(shellSurface,
             &DDEShellSurfaceV2::acceptKeyboardFocusChanged,
</code_context>
<issue_to_address>
**Focus fallback comes from another workspace**

When a v2 surface belongs to a session whose workspace differs from the global current workspace, `updateSurfaceAcceptKeyboardFocus()` removes the wrapper from `workspaceForSurface(wrapper)` but selects the fallback from `m_workspace->current()`; for a surface in a different session workspace, it therefore reads the wrong activation history and attempts to focus an unrelated window or leaves no fallback, disrupting focus for that session.

Select the fallback from the surface's session workspace rather than unconditionally from `m_workspace->current()`.

Also at `src/core/shellhandler.cpp:1259`.
</issue_to_address>

### Comment 3
<location path="src/core/shellhandler.cpp" line_range="1254" />
<code_context>
+    // Refusing keyboard focus must also drop a surface that was already
+    // activated/focused, not just flip the capability bit: dde-shell sets the
+    // property after the surface is mapped and often activated.
+    updateSurfaceAcceptKeyboardFocus(wrapper, shellSurface->acceptKeyboardFocus());
     connect(shellSurface,
             &DDEShellSurfaceV2::acceptKeyboardFocusChanged,
</code_context>
<issue_to_address>
**Focus cleanup lacks coverage**

When a v2 client denies keyboard focus after its surface is already active or focused, the v2 test's `set_keyboard_focus` case checks only that `accept_keyboard_focus` becomes false, so the new cleanup of an already activated or focused surface has no assertion. A regression in that observable focus transition therefore passes the protocol tests.

Add a protocol test that activates or focuses a mapped surface, denies keyboard focus, and asserts that the surface loses the corresponding activation and focus state.

Also at `src/core/shellhandler.cpp:1259-1260`.
</issue_to_address>

### Comment 4
<location path="src/core/shellhandler.cpp" line_range="1258-1260" />
<code_context>
-    connect(ddeShellSurface,
-            &DDEShellSurfaceInterface::acceptKeyboardFocusChanged,
-            this,
-            [this, wrapper](bool accept) {
-                updateSurfaceAcceptKeyboardFocus(wrapper, accept);
-            });
-}
-
</code_context>
<issue_to_address>
**Signal forwarding adds a lambda**

When the v2 surface emits `acceptKeyboardFocusChanged`, the callback only forwards the signal value and captured wrapper to `updateSurfaceAcceptKeyboardFocus()`, so this connection uses a lambda where the repository guidance says not to use one for forwarding to a single member function.

Use a member-function-pointer connection for this forwarding callback, following the repository guidance.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/lockscreen/lockscreenmanager.cpp Resolved
Comment thread src/core/shellhandler.cpp Resolved
Comment thread src/core/shellhandler.cpp Resolved
Comment thread src/core/shellhandler.cpp Resolved
@wineee
wineee marked this pull request as draft November 25, 2026 08:17
@deepin-bot

deepin-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.12.2
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1749

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