Skip to content

ALI-2664: Keep the control bar while the pointer rests on it - #13

Merged
michaelaguiar merged 4 commits into
mainfrom
ali-2664-bar-hover
Dec 4, 2026
Merged

michaelaguiar merged 4 commits into
mainfrom
ali-2664-bar-hover

Conversation

@michaelaguiar

Copy link
Copy Markdown
Member

Fixes ALI-2664.

While a video played, the control bar hid after its 3-second timeout even when the pointer was resting on it, so it could hide while someone reached for a button.

The pointer resting over the bar now keeps it shown, the same way keyboard focus or a slider drag already does:

  • With the pointer resting on the bar during playback, the bar and the pointer stay shown.
  • Moving back onto the video starts the 3-second timer again, and then both hide.
  • Leaving the window from the bar starts the timer too, so the bar still hides once the pointer has gone.
  • The ALI-2649 behaviour is unchanged: a pointer resting on the video lets both hide, and Hyprland repeating an unmoved position doesn't count as motion.

Changes

  • Controls gains on_bar, and may_hide takes the whole Controls so it covers focus, drag and the pointer on the bar.
  • Pointer motion and leave handling moved into pointer_motion and pointer_left, so they can be tested without a Wayland connection.
  • refresh_hover also updates on_bar, for a bar that moves out from under a still pointer (a resize).

Checks

  • cargo test: 133 + 6 pass. The new test the_bar_stays_while_the_pointer_rests_on_it_and_times_out_once_it_leaves runs at scale 2.0 with raw Input values. It fails when !c.on_bar is removed from may_hide.
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check pass.

To try

Play a video, rest the pointer on the bar for a few seconds: the bar and pointer stay. Move onto the video and keep still: both hide after 3 seconds.

While a video played, the bar hid after its timeout even with the pointer
resting on it, so it could go while someone reached for a button. A pointer
over the bar now keeps it, like keyboard focus or a drag; moving back onto the
video or leaving the window starts the time to hide again.
…window resizes

Opening the next video reset the bar's state, so a pointer resting on it no
longer kept it, and a resize could move the bar from under a still pointer (or
under it) without updating whether it was there. Both now recheck from the
pointer's place, and a place left outside the window doesn't count. The
controls-hide token's note names the new rule.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1 (fresh-context reviewer, code-review skill ran):

  • P2, fixed in de0fe68: opening the next media reset the bar state, so a pointer resting on the bar (for example on Next) no longer kept it. New media now rechecks the pointer's place (reset_controls).
  • P3, fixed in de0fe68: a resize could move the bar from under a still pointer, or under it, without updating on_bar. resize now calls refresh_hover when the size or scale changes, and a place left outside the window no longer counts.
  • P3, fixed in de0fe68: the controls-hide token's usage note now names the pointer-on-the-bar rule (src/tokens.rs regenerated with design/build).
  • P3, fixed in de0fe68: the test's off-the-bar point is now one pixel above the bar's top edge, and a new test covers new media, resizes and a pointer outside the window. Each of the three new fixes was removed in turn and the test failed each time.
  • Noted, not changed here: controls-hide is 2 s while the ticket says 3 s. The token is the source; the ticket wording was approximate.
  • Declined from the code-review output: leaving the window mid-drag. drag stays set until the button is released, so it still blocks hiding, and the release restarts the timer.

…place across a scale change

A key could show the bar under a pointer that hadn't moved since the bar hid
and moved, and the bar then timed out under it. Showing the bar now rechecks
the pointer's place, through the one reading motion and refresh_hover use. The
pointer is kept in buffer pixels, so a new scale now rescales it instead of
testing the old place against the new layout.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 2 (fresh-context reviewer, code-review skill ran). The round-1 fixes in de0fe68 were checked and hold.

  • P2, fixed in 9a048fc: a key could show the bar under a pointer that hadn't moved since the bar hid and moved (after a resize), and the bar then timed out under it. Showing the bar now rechecks the pointer's place. Motion, refresh_hover and showing the bar share one reading (bar_under_pointer). New test: a_key_showing_the_bar_under_a_still_pointer_keeps_it.
  • P3, fixed in 9a048fc: the pointer is kept in buffer pixels, so a scale change tested the old place against the new layout. resize now rescales it. New test: a_new_scale_keeps_the_pointer_where_it_is. Both tests fail with their fix removed.
  • P3, fixed in 9a048fc: refresh_hover's doc comment now describes the bar check and the timer.
  • P3, declined: refresh_hover and set_on_bar use Instant::now() rather than a passed-in time. It's not a behaviour bug, and the tests' timing assertions hold with the real clock.

@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 3 (fresh-context reviewer, code-review skill ran, focused on 9a048fc): no P1 or P2. The round-2 fixes hold: no wrong pinning for music, paused, ended, failed, the grid or keyboard-only use; no double scaling; the startup state is safe.

  • P3, fixed in 334b8e9: the README now names the pointer resting on the bar among the times the bar stays, and bar_under_pointer's doc comment says what it returns.
  • P3, declined: after a scale change, the rescaled pointer can differ from the compositor's next position by a rounding step, so one repeated position could count as motion and bring the bar back once. It's rare and corrects itself, and a tolerance in pointer_moved would also swallow real sub-pixel moves.
  • P3, declined: a Move on a hidden bar computes the layout up to three times. It's cheap, and it keeps one shared reading.
  • By design, not changed: a key pressed with the pointer parked on the bar's place keeps the bar (and pointer) until the pointer moves off it. That's the ticket's rule.
  • Pre-existing, not from this PR: a pointer landing on a hidden bar shows it without highlighting a control until the next motion. That's how a click on a hidden bar only shows it.

@michaelaguiar
michaelaguiar marked this pull request as ready for review December 4, 2026 16:48
@michaelaguiar
michaelaguiar merged commit 4cfc09c into main Dec 4, 2026
2 checks passed
@michaelaguiar
michaelaguiar deleted the ali-2664-bar-hover branch December 4, 2026 17:13
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.

1 participant