Skip to content

Ignore static pointer position changes on lock screen wake (#13812) - #13818

Closed
szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/lock-screen-hdmi-wake-loop-13812
Closed

szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/lock-screen-hdmi-wake-loop-13812

Conversation

@szaidi-code

Copy link
Copy Markdown
Contributor

Closes #13812

Summary

When monitors drop HDMI hotplug in standby, Hyprland and Quickshell recreate the output and the WlSessionLockSurface. Qt Quick dispatches a synthetic onPositionChanged to MouseArea with the existing cursor coordinates, which was triggering root.wakeRequested() and waking the display in an endless 5-second cycle.

Changes

  • Gate pointer wake in shell/plugins/lock/LockView.qml by tracking lastX and lastY to ignore static initial surface entry coordinates and require actual mouse movement or clicks to wake.
  • Add regression test assertion in test/shell.d/lock-blank-fingerprint-test.sh.

@sanjyay

sanjyay commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Independent community review

This is an independent community review and unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Tested: Pointer event handling in LockView.qml, surface initialization coordinates, mouse click focus, and lock screen test suites under both headless and compositor-backed environments in an isolated Omarchy test VM.

Result: The fix operates as intended without regressions:

  • Base origin/quattro has unconditional onPositionChanged: root.wakeRequested(). When monitors disconnect/reconnect or outputs are rebuilt following standby, Qt Quick dispatches an initial synthetic onPositionChanged event with existing cursor coordinates upon surface instantiation, repeatedly re-triggering DPMS wake in a loop.
  • On PR branch pr-13818 (1da0883): Initializing lastX and lastY to -1 safely absorbs the initial surface entry coordinates without triggering root.wakeRequested(). Subsequent actual pointer movement (lastX !== mouse.x || lastY !== mouse.y) reliably invokes root.wakeRequested().
  • Clicks via onClicked continue to wake and focus the password field immediately (root.forcePasswordFocus()).
  • All 46 assertions across the lock test suites pass cleanly, including Wayland compositor runs for sensor tracking and password overflow.
Testing details
  • Tested PR commit: 1da0883f10e1b5f25a519ffdd3f799cdd85873c5
  • Suite results in VM:
    • bash test/shell.d/lock-blank-fingerprint-test.sh: 5/5 assertions passed (including new static assertion for coordinate gating).
    • bash test/shell.d/lock-fingerprint-indicator-test.sh: passed under Wayland (WAYLAND_DISPLAY=wayland-1).
    • bash test/shell.d/lock-password-overflow-test.sh: passed under Wayland.
    • bash test/shell.d/lock-stranded-recovery-test.sh: passed (17 assertions).
    • bash test/shell.d/lock-wallpaper-preload-test.sh: passed (5 assertions).
    • bash test/shell.d/sleep-lock-test.sh: passed (19 assertions).
    • bash test/shell.d/system-lock-test.sh: passed.
    • git diff --check origin/quattro: clean.

If you'd prefer not to receive these independent reviews on your PRs, reply to this comment, and I won't review your future PRs.

@chessing234 chessing234 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please address the remaining recovery case below.

MouseArea {
anchors.fill: parent
hoverEnabled: true
property int lastX: -1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please store lastX and lastY as real: mouse event coordinates are real-valued, but these integer properties discard the fractional part. two position events at the same (10.5, 20.5) therefore still call wakeRequested() on the second event, so the static-position wake loop remains possible at fractional coordinates; please cover this case alongside integer positions.

@jandrusk

jandrusk commented Oct 1, 2026

Copy link
Copy Markdown

Agree with Chessing234's CHANGES_REQUESTED: MouseEvent.x/y are real, so storing them in int lastX/lastY truncates and can still re-fire wakeRequested() on a second static event at the same fractional coordinates (e.g. (10.5, 20.5)). Please use real (or compare with an epsilon) and add a fractional-coordinate case next to the integer one in the fixture.

@omarchybot omarchybot added the bug Something isn't working label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed against quattro by reading it with #13812 and the other open fixes for the same wake loop. Nothing was run on a worker, because of the conclusion below.

This does not stop the loop the way #13812 asks, and older open pull requests already carry this bug. On quattro, the only thing that re-arms the lock's 5s blank after it has fired is runWake() (or password input). With this change the returning output's first pointer event no longer reaches runWake(), so nothing re-arms the blank: the monitor that dropped HPD comes back lit with the lock screen and stays lit until someone touches the machine. onScreensChanged in shell/plugins/lock/Service.qml only clears displaysBlank, and the DPMS poll only records state. The flashing stops, but the panel stays on all night, which is not the "stays off until real input" the issue expects and is worse on an OLED.

The review from @chessing234 also holds: lastX and lastY are declared int (shell/plugins/lock/LockView.qml:141-142), while MouseEvent.x and y are real. A repeated event at a fractional position such as (10.5, 20.5) never equals its truncated copy, so it still wakes. They would need to be real. The new test only matches the source text with a regular expression, so it passes whether or not the gate stops anything.

The older open fixes for this bug are #8581, #8896, #10343, #11991 (draft) and #13129. #10343 gates the same pointer path, and it re-arms the blank instead of swallowing the event, so the returning panel goes dark again. #13129 enables amdgpu's HDMI HPD debounce, so on AMD with HDMI the output is never removed and re-added in the first place. Both are waiting on the maintainer. Where fixes are this close, the older one keeps it, and this one has no case that the older ones miss.

The bug label comes from an earlier pass where two models classified it the same way; the second was deepseek-v4p1-flash. The review is by Claude Opus 5.5. Codex Medium gave the second opinion. It was given this pull request and its competitors without my conclusion. It traced the same lit-panel outcome, confirmed the int defect, and also picked #10343 over this one. It can read this session's working files, so its agreement is not guaranteed to be independent. This now waits on the maintainer to choose among the fixes for #13812.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @szaidi-code. #10343 and #13129 got there first with fixes for the lock-screen wake loop, and this one leaves the returning monitor lit, so it is closed in favour of them.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock screen wakes in a loop on monitors that drop HDMI hotplug in standby

6 participants