Skip to content

perf(core): cache cursor output and emit it on change - #1453

Merged
zccrs merged 1 commit into
linuxdeepin:masterfrom
gugullll:fix/cursorOutputChanged
Sep 30, 2026
Merged

zccrs merged 1 commit into
linuxdeepin:masterfrom
gugullll:fix/cursorOutputChanged

Conversation

@gugullll

@gugullll gugullll commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Add cursorOutputChanged(Output*) to RootSurfaceContainer and cache the output under the cursor. The signal fires only when the output actually changes, so LockScreen repositions its global login view on an output switch instead of on every cursor motion.

为 RootSurfaceContainer 新增 cursorOutputChanged(Output*) 信号,并缓存 光标所在输出;仅在输出真正变化时发出。锁屏登录界面因此只在切换输出时重新排布,而不再随每次鼠标移动触发。

Log: 新增光标输出变化信号并缓存,避免每次移动重排布
PMS: TASK-390751
Influence: cursorOutput() 改为读取缓存;锁屏登录界面仅在切换输出时重新排布。

Summary by Sourcery

Cache the cursor’s current output and use output-change notifications to avoid unnecessary lock-screen layout updates.

New Features:

  • Add a cursor-output change signal to RootSurfaceContainer for observing output switches.

Enhancements:

  • Cache the output beneath the cursor and update it only when the cursor crosses outputs or layout changes.
  • Reposition the lock-screen login view only when the cursor’s output changes instead of on every cursor movement.

Add cursorOutputChanged(Output*) to RootSurfaceContainer and cache the
output under the cursor. The signal fires only when the output actually
changes, so LockScreen repositions its global login view on an output
switch instead of on every cursor motion.

为 RootSurfaceContainer 新增 cursorOutputChanged(Output*) 信号,并缓存
光标所在输出;仅在输出真正变化时发出。锁屏登录界面因此只在切换输出时
重新排布,而不再随每次鼠标移动触发。

Log: 新增光标输出变化信号并缓存,避免每次移动重排布
PMS: TASK-390751
Influence: cursorOutput() 改为读取缓存;锁屏登录界面仅在切换输出时重新排布。
@sourcery-ai

sourcery-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

Caches the cursor’s current output in RootSurfaceContainer and emits cursorOutputChanged only when it changes, allowing LockScreen to reposition the global login view only when the cursor crosses outputs while preserving refreshes after output-layout changes.

Sequence diagram for cached cursor output changes

sequenceDiagram
    participant Cursor as WCursor
    participant Root as RootSurfaceContainer
    participant Lock as LockScreen

    Cursor->>Root: positionChanged
    Root->>Root: updateCursorOutput()
    alt output changed
        Root-->>Lock: cursorOutputChanged(Output*)
        Lock->>Lock: repositionLoginView()
    else same output
        Root-->>Root: no signal emitted
    end
Loading

File-Level Changes

Change Details Files
Caches the output currently under the cursor and emits a notification only when that output changes.
  • Adds a guarded output cache and change-detection signal.
  • Refreshes the cache on cursor movement and after output-layout initialization, including layout changes without cursor motion.
  • Changes cursorOutput() to return the cached output.
src/core/rootsurfacecontainer.cpp
src/core/rootsurfacecontainer.h
Updates lock-screen login-view tracking to respond to output transitions rather than cursor motion.
  • Connects repositioning to cursorOutputChanged instead of WCursor::positionChanged.
  • Removes the cursor-position slot and no longer depends directly on WCursor.
src/core/lockscreen.cpp
src/core/lockscreen.h

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 reviewed your changes and they look great!


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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gugullll, 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

@zccrs
zccrs merged commit 5b88f9a into linuxdeepin:master Sep 30, 2026
7 checks passed
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.

4 participants