Skip to content

Only wake a locked session on real pointer motion - #15342

Open
Ante042 wants to merge 4 commits into
omacom:quattrofrom
Ante042:fix-lock-hotplug-wake
Open

Ante042 wants to merge 4 commits into
omacom:quattrofrom
Ante042:fix-lock-hotplug-wake

Conversation

@Ante042

@Ante042 Ante042 commented Oct 13, 2026

Copy link
Copy Markdown

Locking an M1 Pro in clamshell with a monitor on USB-C to DisplayPort left the screen cycling on and off until I pulled the power. On Asahi the DCP reports the port disconnected the moment it blanks, then brings it back about 1.4 seconds later. Each time the output goes and comes back the lock maps a new surface under the resting pointer, and the MouseArea's position event on that surface counted as the user moving the mouse. That woke the displays, re-armed the five-second blank, and started it all over.

The lock now only wakes once the pointer has actually moved across a surface, so a surface appearing under a still pointer is ignored. Clicks, keys and typing wake it as before. I confirmed it with logging in LockView on the affected machine, where every position after a hotplug landed on a fresh surface with no prior position, and with the change the cycling stopped. The new lock-pointer-wake test covers the motion check.

A lock surface created under a resting pointer gets a position event with
no motion behind it, and the lock took that for the user moving the mouse.
On a monitor that drops off the bus when blanked (Apple Silicon DCP over
USB-C to DisplayPort does this), every blank removes and re-adds the
output, the new surface wakes the displays, the blank timer re-arms, and
the screen cycles on and off for as long as the machine stays locked.

The lock now wakes only once the pointer actually moves across a surface.
Clicks, keys and typing still wake it as before.
@omarchybot omarchybot added the bug Something isn't working label Oct 17, 2026
The reference position moved with every event, so a pointer creeping in sub-pixel steps -- a slow nudge on a scaled display -- never got a whole pixel from it and never woke the lock. It now holds until the pointer has gone a pixel from where it was last counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion, and run on an Omarchy ISO worker. I don't have an M1 to reproduce the DCP dropout itself, so I stood in for it with Hyprland headless outputs.

The mechanism is real, and the change stops it. With the screen locked and blank, adding an output woke every display on current quattro, with no input at all. With this pull request merged onto quattro, the other display stayed dark. Twice each, with the same result. Real mouse motion (a uinput device, not a cursor warp) still wakes the lock.

One defect, fixed on your branch in fbc0cfc. pointerMovedTo moved its reference to every new position, so a pointer creeping in sub-pixel steps never got a whole pixel from it. On the worker, twelve slow steps moved the cursor 3px and left the lock dark, while quattro woke. The reference now holds until the pointer has gone a pixel from where it was last counted, and the fixture covers it. Codex found the problem; a second Codex round on the commit found nothing.

On quattro this may not stop the cycling. Since this branch was forked, #15294 made a display arriving restart the five-second blank (onScreensChanged in shell/plugins/lock/Service.qml). I simulated a monitor that drops its port when blanked and comes back 1.4 seconds later. With this pull request merged onto quattro it still cycled about every 7 seconds, six times in 40 seconds, because Hyprland brings the returning output up lit and the lock blanks it again. On this branch's own base the cycling stopped, but the returning output stayed lit. Your test on the M1 ran on that older base, which may be why it looked fixed.

Two things decide what happens next, and only your machine can answer them:

  1. Merge quattro into the branch, put it on the M1 (omarchy dev link to the checkout), lock in clamshell, and tell us whether the screen still cycles.
  2. When the DCP brings the port back, does the panel come back lit (check hyprctl monitors for dpmsStatus), or does it stay dark?

If it still cycles, the fix has to cover a display arriving while the lock has the displays off. That changes the behaviour #15294 chose, so the maintainer has to decide it. The new test checks pointerMovedTo directly, not the MouseArea wiring, so the worker runs above are what cover the wiring. ./test/cli passes on the worker, and so do the new test, lock-autorepeat, lock-password-overflow, system-lock and sleep-lock. Three lock tests (lock-blank-fingerprint, lock-wallpaper-preload, lock-stranded-recovery) need node, which the worker doesn't have, so they did not run.

Waiting on you for the M1 result.

@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects remain.

Summary

The lock now ignores the first pointer position on a surface and wakes only after movement reaches one logical pixel.

  • Locked displays wake on pointer movement, not when a monitor surface appears.

No new actionable issues were found. The previous test-coverage finding is addressed. Tests were not run.

Reviews (2) · Last reviewed commit: "Test the lock's pointer wake through the..." · Reviewed by Greptile

@Ante042

Ante042 commented Oct 17, 2026

Copy link
Copy Markdown
Author

Thanks for the thorough review and the sub-pixel fix! I've run both checks on the M1.

I merged quattro into the branch and ran the shell from the checkout in clamshell, with a ROG on one USB-C port and a VG278 on the other. Blanking alone doesn't drop either port here, not even after two minutes with DPMS off. The kernel disconnects the DPTX, but Hyprland keeps the output. The drop I'm seeing comes on wake instead: about 2.5 seconds after DPMS goes back on, the VG278 bounces its HPD and comes back roughly 20 seconds later. By then the lock has blanked again, so it does arrive while the lock has the displays off. That's the arrival I described in the PR, even though the timing in my description was off.

To your second question: the returning output comes back lit (dpmsStatus: true) while the other one stays dark. With this branch on quattro I locked, let it blank, then replugged the VG278 twice while it was dark. Each time it came back lit, the restarted countdown from #15294 blanked it again after five seconds, and it stayed dark. The ROG never woke, and there was no cycling over the three minutes. So on this hardware the two changes fit together. #15294 handles the lit arrival, and this PR keeps that arrival from counting as a wake.

I also took Greptile's point about the test. The wake now goes through a small pointerMoved() that the MouseArea calls, the fixture counts wakeRequested instead of reading the return value, and the script checks that the MouseArea still routes through it. I made sure it fails both if pointerMoved() wakes unconditionally and if onPositionChanged goes back to waking directly. The lock tests all pass here too, including the three that needed node on the worker.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for running both checks on the M1. That answers the question I left open: on your hardware the returning display comes back lit, the restarted countdown from #15294 blanks it, and this change keeps its arrival from counting as a wake. Re-reviewed at c2064cb by Claude Opus 5.5, with Codex Medium as a second opinion, and run on an Omarchy ISO worker.

Reproduced on current quattro, without needing the M1. With the lock blank and the pointer resting on the only display, a second display arriving at the origin pushes the first one aside and puts the resting pointer on a fresh lock surface. With no input, quattro woke the dark display about two seconds later. This branch left it dark, and the new display re-blanked after five seconds. Reverting LockView.qml on this branch brought the wake back. Real mouse motion from a uinput device still wakes the lock on this branch.

The test change holds up. pointerMoved() is the same logic as before, moved into a function the fixture can drive, and counting wakeRequested means the fixture now fails if the wake is never emitted. With LockView.qml reverted, the new test fails on the routing check. ./test/cli passes on the worker, and so does every lock, idle and wake test under test/shell.d/, including the three that need node. The one exception is lock-appear-budget, a startup timing budget that fails the same way on quattro on the same worker.

Codex found nothing that needs changing. Two notes I'm not acting on: a single motion report that crosses from one blank display onto another and then stops is swallowed as a first position, and the grep in the test is tied to the exact formatting of the onPositionChanged line. The first comes with telling a resting pointer from a moving one, and another nudge, click or key wakes it. The second only costs a test edit if that line is ever reformatted.

Two older pull requests fix the same symptom differently. #10343 ignores pointer motion for ten seconds after any display change, so someone who moves the mouse just after a monitor is plugged in or returns gets no wake. #11991 removes pointer-motion wake altogether. This one filters only the position a fresh surface reports and keeps every later motion as a wake, so I'd suggest it over both. Codex reached the same choice when asked separately, though it could read this session's notes, so that agreement isn't fully independent.

Nothing is left for you to do. It's waiting on the maintainer.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants