Skip to content

fix(lockscreen): prevent window interaction on secondary screens whil…#1057

Merged
Groveer merged 1 commit into
linuxdeepin:masterfrom
glyvut:locker
Jun 29, 2026
Merged

fix(lockscreen): prevent window interaction on secondary screens whil…#1057
Groveer merged 1 commit into
linuxdeepin:masterfrom
glyvut:locker

Conversation

@glyvut

@glyvut glyvut commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

…e locked

Set Greeter visible to true so it covers all outputs with MouseArea, preventing interaction with windows on secondary screens. LockView and ShutdownView are wrapped in a Loader with the original primary‑output condition, keeping them instantiated only on the primary display.

将 Greeter 的 visible 设为 true 使其覆盖所有输出并拦截输入;
LockView 和 ShutdownView 通过 Loader 仅在主屏加载,修复多屏锁屏
时副屏窗口仍可操作的问题。

Log: 修复多屏锁屏副屏可操作的问题
PMS: BUG-367461
Influence: 锁屏状态下副屏不再有可交互的锁屏界面,输入被正确拦截。

Summary by Sourcery

Ensure the lockscreen greeter covers all outputs while only rendering lock and shutdown views on the primary display to fix multi‑monitor interaction issues.

Bug Fixes:

  • Prevent window interaction on secondary screens while the system is locked by globally showing the greeter and intercepting input across all outputs.

Enhancements:

  • Refactor LockView and ShutdownView into Loader-based components that activate only on the primary output or when the shutdown view is requested.

@sourcery-ai

sourcery-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Greeter is now always visible across all outputs to intercept input, while LockView and ShutdownView are instantiated via Loaders only on the primary output to avoid interactive lock UI on secondary screens.

Flow diagram for lockscreen behavior across multiple outputs

flowchart LR
    subgraph Outputs
        primary[primary_output]
        secondary[secondary_output]
    end

    Greeter[Greeter visible:true]
    LockLoader[lockViewLoader active: primaryOutputName==output.name]
    ShutdownLoader[shutdownViewLoader active: showShutdownView && primaryOutputName==output.name]

    primary --> Greeter
    secondary --> Greeter

    Greeter --> LockLoader
    Greeter --> ShutdownLoader

    LockLoader --> LockView[LockView instantiated]
    ShutdownLoader --> ShutdownView[ShutdownView instantiated]

    secondary -. no active loaders .- LockView
    secondary -. input intercepted by Greeter .- ShutdownView
Loading

File-Level Changes

Change Details Files
Always show the Greeter overlay on all outputs to ensure input interception on secondary screens.
  • Changed Greeter visibility condition to a constant true value so it no longer depends on the primary output name.
src/plugins/lockscreen/qml/Greeter.qml
Restrict LockView and ShutdownView instantiation to the primary output using Loader and Component indirection.
  • Wrapped LockView in a Loader with an active condition based on whether the current output matches the primary output.
  • Extracted LockView into a Component used as the Loader's sourceComponent while preserving the existing animationPlayFinished behavior.
  • Wrapped ShutdownView in a Loader with an active condition requiring both the shutdown flag and that the output matches the primary output.
  • Extracted ShutdownView into a Component used as the Loader's sourceComponent while preserving the existing switchUser handler and anchoring behavior.
src/plugins/lockscreen/qml/Greeter.qml

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 1 issue, and left some high level feedback:

  • Changing Greeter.visible to always true alters the previous primary-output-based visibility logic; if anything else in the file or surrounding code depends on Greeter only being visible on the primary output (for layout or animations), consider scoping this change specifically to the MouseArea/input interception instead of the entire FocusScope.
  • LockView and ShutdownView are now wrapped in Loaders and instantiated via Components; double-check that there are no remaining references to the old lockView/shutdownView IDs elsewhere in this QML or related files, and if needed expose properties or signals through the loaders so those interactions still work.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `Greeter.visible` to always `true` alters the previous primary-output-based visibility logic; if anything else in the file or surrounding code depends on Greeter only being visible on the primary output (for layout or animations), consider scoping this change specifically to the MouseArea/input interception instead of the entire `FocusScope`.
- LockView and ShutdownView are now wrapped in `Loader`s and instantiated via `Component`s; double-check that there are no remaining references to the old `lockView`/`shutdownView` IDs elsewhere in this QML or related files, and if needed expose properties or signals through the loaders so those interactions still work.

## Individual Comments

### Comment 1
<location path="src/plugins/lockscreen/qml/Greeter.qml" line_range="122-125" />
<code_context>

-    LockView {
-        id: lockView
+    Loader {
+        id: lockViewLoader
         anchors.fill: parent
-        onAnimationPlayFinished: function () {
-            if (lockView.state === LoginAnimation.Hide) {
-                root.animationPlayFinished()
+        active: primaryOutputName === "" || primaryOutputName === output.name
+        sourceComponent: lockViewComponent
+    }
</code_context>
<issue_to_address>
**suggestion:** The repeated primary-output condition could be factored into a dedicated property for readability and maintainability.

This condition (`primaryOutputName === "" || primaryOutputName === output.name`) is now duplicated across multiple loaders. Consider extracting it into a reusable property, e.g. `property bool isPrimaryOutput: primaryOutputName === "" || primaryOutputName === output.name`, to improve readability and make future changes easier.

Suggested implementation:

```
    visible: true

    // Reusable flag indicating whether this output is the primary one
    property bool isPrimaryOutput: primaryOutputName === "" || primaryOutputName === output.name

    x: outputItem.x
    y: outputItem.y
        enabled: true
    }

```

```
    Loader {
        id: lockViewLoader
        anchors.fill: parent
        active: isPrimaryOutput

```

The same repeated condition (`primaryOutputName === "" || primaryOutputName === output.name`) should be replaced with `isPrimaryOutput` in any other `Loader` (or related components) within this output context to fully apply the refactoring and keep the logic centralized.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/plugins/lockscreen/qml/Greeter.qml Outdated
@deepin-bot

deepin-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.13
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1063

…e locked

Set Greeter visible to true so it covers all outputs with MouseArea,
preventing interaction with windows on secondary screens. LockView and
ShutdownView are wrapped in a Loader with the original primary‑output
condition, keeping them instantiated only on the primary display.

将 Greeter 的 visible 设为 true 使其覆盖所有输出并拦截输入;
LockView 和 ShutdownView 通过 Loader 仅在主屏加载,修复多屏锁屏
时副屏窗口仍可操作的问题。

Log: 修复多屏锁屏副屏可操作的问题
PMS: BUG-367461
Influence: 锁屏状态下副屏不再有可交互的锁屏界面,输入被正确拦截。
@Groveer Groveer merged commit 342ad8c into linuxdeepin:master Jun 29, 2026
9 checks passed
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: glyvut, Groveer

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

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