From 0572385b523c265973c1358a02db951826ce2b29 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Fri, 4 Dec 2026 09:35:25 -0700 Subject: [PATCH 1/4] ALI-2664: Keep the control bar while the pointer rests on it 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. --- src/app/player_ui.rs | 131 +++++++++++++++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 29 deletions(-) diff --git a/src/app/player_ui.rs b/src/app/player_ui.rs index 184eb4e..2d11517 100644 --- a/src/app/player_ui.rs +++ b/src/app/player_ui.rs @@ -27,14 +27,17 @@ pub struct Controls { pub hover: Option, /// A slider held down with the pointer. pub drag: Option, + /// The pointer rests over the bar. While it's there the bar stays. + pub on_bar: bool, pub shown: bool, pub hide_at: Option, } /// Whether the bar may hide by itself: only while a video plays, with no keyboard focus or -/// drag in it (Mike, 2026-12-02: paused, ended, music and a focus in the bar keep it). -pub fn may_hide(kind: Kind, phase: &Phase, focus: Option, drag: Option) -> bool { - kind == Kind::Video && *phase == Phase::Playing && focus.is_none() && drag.is_none() +/// drag in it (Mike, 2026-12-02: paused, ended, music and a focus in the bar keep it) and the +/// pointer not resting on it (Mike, 2026-12-04, ALI-2664). +pub fn may_hide(kind: Kind, phase: &Phase, c: &Controls) -> bool { + kind == Kind::Video && *phase == Phase::Playing && c.focus.is_none() && c.drag.is_none() && !c.on_bar } /// Whether the pointer is hidden: with the bar, once the bar hid by itself over a playing @@ -52,7 +55,7 @@ impl App { /// Something happened: show the bar, and hide it `controls-hide` later if it may. pub(super) fn poke_controls(&mut self, now: Instant) { let Some(m) = &self.media else { return }; - let may = may_hide(m.kind, &m.phase(), self.controls.focus, self.controls.drag); + let may = may_hide(m.kind, &m.phase(), &self.controls); if !self.controls.shown { self.controls.shown = true; self.overlay_all(); @@ -64,7 +67,7 @@ impl App { pub(super) fn expire_controls(&mut self, now: Instant) { if self.controls.hide_at.is_some_and(|t| now >= t) { self.controls.hide_at = None; - let may = self.media.as_ref().is_some_and(|m| may_hide(m.kind, &m.phase(), self.controls.focus, self.controls.drag)); + let may = self.media.as_ref().is_some_and(|m| may_hide(m.kind, &m.phase(), &self.controls)); if may && self.controls.shown { self.controls.shown = false; self.controls.hover = None; @@ -347,11 +350,22 @@ impl App { /// motion: for when the bar came or went while the pointer stayed put. pub(super) fn refresh_hover(&mut self) { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); - let hover = if self.controls.shown { self.bar_layout().and_then(|l| l.hit(x, y)) } else { None }; + let l = self.bar_layout(); + let hover = if self.controls.shown { l.and_then(|l| l.hit(x, y)) } else { None }; if hover != self.controls.hover { self.controls.hover = hover; self.overlay_bar(); } + // The bar can move from under a still pointer, as when the window resizes. + let on_bar = self.controls.shown && l.is_some_and(|l| l.bar.contains(x, y)); + self.set_on_bar(on_bar, Instant::now()); + } + + /// Whether the pointer rests on the bar. Coming off it starts the time to hide again. + pub(super) fn set_on_bar(&mut self, on_bar: bool, now: Instant) { + if std::mem::replace(&mut self.controls.on_bar, on_bar) && !on_bar && self.controls.shown { + self.poke_controls(now); + } } /// The pointer, over a video or song. True if it was the player's. @@ -363,23 +377,11 @@ impl App { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); match *ev { Input::Move { .. } => { - let was_shown = self.controls.shown; - self.poke_controls(now); - let l = self.bar_layout(); - if let (Some(c), Some(l)) = (self.controls.drag, l) { - self.slide(c, l, x); - } - let hover = if was_shown { l.and_then(|l| l.hit(x, y)) } else { None }; - if hover != self.controls.hover { - self.controls.hover = hover; - self.overlay_bar(); - } + self.pointer_motion(now); true } Input::Leave => { - if self.controls.hover.take().is_some() { - self.overlay_bar(); - } + self.pointer_left(now); false } Input::Button { button: BTN_LEFT, pressed } => { @@ -417,6 +419,32 @@ impl App { } } + /// The pointer moved to `self.pointer`, over a video or song. + fn pointer_motion(&mut self, now: Instant) { + let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); + let was_shown = self.controls.shown; + let l = self.bar_layout(); + // Before the poke, so a pointer on the bar keeps it from timing out. + self.controls.on_bar = l.is_some_and(|l| l.bar.contains(x, y)); + self.poke_controls(now); + if let (Some(c), Some(l)) = (self.controls.drag, l) { + self.slide(c, l, x); + } + let hover = if was_shown { l.and_then(|l| l.hit(x, y)) } else { None }; + if hover != self.controls.hover { + self.controls.hover = hover; + self.overlay_bar(); + } + } + + /// The pointer left the window. + fn pointer_left(&mut self, now: Instant) { + if self.controls.hover.take().is_some() { + self.overlay_bar(); + } + self.set_on_bar(false, now); + } + /// The pointer at `x` on a slider sets its value. fn slide(&mut self, c: Control, l: Layout, x: i32) { let Some(r) = l.rect(c) else { return }; @@ -754,15 +782,17 @@ mod tests { use super::*; #[test] - fn the_bar_hides_only_while_a_video_plays_with_no_focus_in_it() { - assert!(may_hide(Kind::Video, &Phase::Playing, None, None)); - assert!(!may_hide(Kind::Video, &Phase::Paused, None, None)); - assert!(!may_hide(Kind::Video, &Phase::Ended, None, None)); - assert!(!may_hide(Kind::Video, &Phase::Opening, None, None)); - assert!(!may_hide(Kind::Video, &Phase::Failed("x".into()), None, None)); - assert!(!may_hide(Kind::Music, &Phase::Playing, None, None)); - assert!(!may_hide(Kind::Video, &Phase::Playing, Some(Control::Play), None)); - assert!(!may_hide(Kind::Video, &Phase::Playing, None, Some(Control::Position))); + fn the_bar_hides_only_while_a_video_plays_with_no_focus_or_pointer_in_it() { + let free = Controls::default(); + assert!(may_hide(Kind::Video, &Phase::Playing, &free)); + assert!(!may_hide(Kind::Video, &Phase::Paused, &free)); + assert!(!may_hide(Kind::Video, &Phase::Ended, &free)); + assert!(!may_hide(Kind::Video, &Phase::Opening, &free)); + assert!(!may_hide(Kind::Video, &Phase::Failed("x".into()), &free)); + assert!(!may_hide(Kind::Music, &Phase::Playing, &free)); + assert!(!may_hide(Kind::Video, &Phase::Playing, &Controls { focus: Some(Control::Play), ..Controls::default() })); + assert!(!may_hide(Kind::Video, &Phase::Playing, &Controls { drag: Some(Control::Position), ..Controls::default() })); + assert!(!may_hide(Kind::Video, &Phase::Playing, &Controls { on_bar: true, ..Controls::default() })); } #[test] @@ -810,6 +840,49 @@ mod tests { assert!(a.pointer_moved(&at(50.5, 40.0)), "back over the window counts, even at the same place"); } + #[test] + fn the_bar_stays_while_the_pointer_rests_on_it_and_times_out_once_it_leaves() { + let t = Instant::now(); + let mut a = playing("clip.mp4", false, false); + a.scale = 2.0; + let bar = a.bar_layout().expect("a bar").bar; + // In surface pixels, as the compositor sends them: the bar's middle, and the video above. + let cx = (bar.x + bar.w / 2) as f64 / 2.0; + let on = || Input::Move { x: cx, y: (bar.y + bar.h / 2) as f64 / 2.0 }; + let off = || Input::Move { x: cx, y: (bar.y / 2) as f64 / 2.0 }; + let feed = |a: &mut App, ev: Input, now: Instant| { + assert!(a.pointer_moved(&ev), "{ev:?} is motion"); + match ev { + Input::Leave => a.pointer_left(now), + _ => a.pointer_motion(now), + } + }; + feed(&mut a, on(), t); + assert!(a.controls.shown && a.controls.on_bar, "on the bar"); + a.expire_controls(t + motion::CONTROLS_HIDE * 10); + assert!(a.controls.shown && !a.pointer_hidden(), "resting on the bar keeps it and the pointer"); + // Hyprland repeating the place doesn't change that. + assert!(!a.pointer_moved(&on())); + a.refresh_hover(); + a.expire_controls(t + motion::CONTROLS_HIDE * 11); + assert!(a.controls.shown && a.controls.on_bar, "still on the bar"); + let t2 = t + motion::CONTROLS_HIDE * 12; + feed(&mut a, off(), t2); + assert!(!a.controls.on_bar && a.controls.hide_at.is_some(), "back over the video, the time to hide starts again"); + a.expire_controls(t2 + motion::CONTROLS_HIDE); + assert!(!a.controls.shown && a.pointer_hidden(), "and then both hide"); + // Leaving the window from the bar starts the time to hide too. + let t3 = t2 + motion::CONTROLS_HIDE * 2; + feed(&mut a, on(), t3); + a.expire_controls(t3 + motion::CONTROLS_HIDE); + assert!(a.controls.shown, "kept while on the bar"); + let t4 = t3 + motion::CONTROLS_HIDE * 2; + feed(&mut a, Input::Leave, t4); + assert!(!a.controls.on_bar && a.controls.hide_at.is_some(), "leaving starts the time to hide"); + a.expire_controls(t4 + motion::CONTROLS_HIDE); + assert!(!a.controls.shown, "so the bar still hides once the pointer has gone"); + } + #[test] fn the_pointer_hides_with_the_bar_while_a_video_plays_and_motion_brings_it_back() { let t = Instant::now(); From de0fe6816e97ec884fa5e56ed7ef23d7dcd1b971 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Fri, 4 Dec 2026 09:39:04 -0700 Subject: [PATCH 2/4] ALI-2664: Recheck the pointer on the bar when new media opens or the 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. --- design/tokens.json | 2 +- src/app.rs | 5 +++-- src/app/player_ui.rs | 50 +++++++++++++++++++++++++++++++++++++++----- src/tokens.rs | 2 +- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/design/tokens.json b/design/tokens.json index 812a2eb..5e83cc9 100644 --- a/design/tokens.json +++ b/design/tokens.json @@ -366,7 +366,7 @@ { "name": "controls-hide", "value": "2s", - "usage": "While a video plays, how long the control bar stays after the pointer last moved or a key was pressed. Paused, ended, loading, failed, music, or a keyboard focus inside the bar: it stays. The mouse pointer hides and comes back with it." + "usage": "While a video plays, how long the control bar stays after the pointer last moved or a key was pressed. Paused, ended, loading, failed, music, a keyboard focus inside the bar, or the pointer resting on the bar: it stays. The mouse pointer hides and comes back with it." }, { "name": "seek-step", diff --git a/src/app.rs b/src/app.rs index 0f76789..1651886 100644 --- a/src/app.rs +++ b/src/app.rs @@ -256,6 +256,8 @@ impl App { } if changed { self.overlay_all(); + // The bar moved; the pointer may be on it now, or no longer. + self.refresh_hover(); } let size = self.media.as_ref().map(|m| m.kind).map(|k| self.media_box(k)); if let (Some(m), Some(b)) = (&mut self.media, size) { @@ -305,12 +307,11 @@ impl App { } else { Media::failed(path, kind, "this desktop can't show video from another process (it lacks linux-dmabuf or viewporter)".into()) }); - self.controls = Controls { focus, ..Controls::default() }; self.track += 1; self.seek_said_at = None; let opening = format!("Opening {}", self.name()); self.say(opening); - self.poke_controls(Instant::now()); + self.reset_controls(focus, Instant::now()); self.after_media_news(None); self.all(); self.a11y_dirty = true; diff --git a/src/app/player_ui.rs b/src/app/player_ui.rs index 2d11517..f80b6cf 100644 --- a/src/app/player_ui.rs +++ b/src/app/player_ui.rs @@ -350,24 +350,33 @@ impl App { /// motion: for when the bar came or went while the pointer stayed put. pub(super) fn refresh_hover(&mut self) { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); - let l = self.bar_layout(); + // Outside the window, the last place it was isn't where it is. + let l = self.bar_layout().filter(|_| self.pointer_in); let hover = if self.controls.shown { l.and_then(|l| l.hit(x, y)) } else { None }; if hover != self.controls.hover { self.controls.hover = hover; self.overlay_bar(); } - // The bar can move from under a still pointer, as when the window resizes. + // The bar can move from under a still pointer, or come under it: a resize, new media. let on_bar = self.controls.shown && l.is_some_and(|l| l.bar.contains(x, y)); self.set_on_bar(on_bar, Instant::now()); } - /// Whether the pointer rests on the bar. Coming off it starts the time to hide again. + /// Whether the pointer rests on the bar. Coming onto it stops the time to hide; coming off + /// it starts it again. pub(super) fn set_on_bar(&mut self, on_bar: bool, now: Instant) { - if std::mem::replace(&mut self.controls.on_bar, on_bar) && !on_bar && self.controls.shown { + if std::mem::replace(&mut self.controls.on_bar, on_bar) != on_bar && self.controls.shown { self.poke_controls(now); } } + /// New media opened: a fresh bar, keeping the keyboard focus, and the pointer's place on it. + pub(super) fn reset_controls(&mut self, focus: Option, now: Instant) { + self.controls = Controls { focus, ..Controls::default() }; + self.poke_controls(now); + self.refresh_hover(); + } + /// The pointer, over a video or song. True if it was the player's. pub(super) fn media_pointer(&mut self, wl: &mut Wl, ev: &Input) -> bool { if self.media.is_none() || self.grid.is_some() { @@ -849,7 +858,8 @@ mod tests { // In surface pixels, as the compositor sends them: the bar's middle, and the video above. let cx = (bar.x + bar.w / 2) as f64 / 2.0; let on = || Input::Move { x: cx, y: (bar.y + bar.h / 2) as f64 / 2.0 }; - let off = || Input::Move { x: cx, y: (bar.y / 2) as f64 / 2.0 }; + // Just above the bar's top edge. + let off = || Input::Move { x: cx, y: (bar.y - 1) as f64 / 2.0 }; let feed = |a: &mut App, ev: Input, now: Instant| { assert!(a.pointer_moved(&ev), "{ev:?} is motion"); match ev { @@ -883,6 +893,36 @@ mod tests { assert!(!a.controls.shown, "so the bar still hides once the pointer has gone"); } + #[test] + fn the_bar_stays_under_a_resting_pointer_when_new_media_opens_or_the_window_resizes() { + let t = Instant::now(); + let mut a = playing("clip.mp4", false, false); + let bar = a.bar_layout().expect("a bar").bar; + let on_bar = Input::Move { x: (bar.x + bar.w / 2) as f64, y: (bar.y + bar.h / 2) as f64 }; + assert!(a.pointer_moved(&on_bar)); + a.pointer_motion(t); + assert!(a.controls.on_bar); + // As sync_media does for the next video, opened with Next or a key. + a.reset_controls(None, t); + assert!(a.controls.on_bar && a.controls.hide_at.is_none(), "the pointer is still on the new bar"); + a.expire_controls(t + motion::CONTROLS_HIDE * 2); + assert!(a.controls.shown, "so it stays"); + // Taller: the bar moves down from under the still pointer. + a.resize(400, 600, 1.0); + assert!(!a.controls.on_bar && a.controls.hide_at.is_some(), "off the bar after the resize"); + a.expire_controls(Instant::now() + motion::CONTROLS_HIDE); + assert!(!a.controls.shown && a.pointer_hidden(), "so it hides"); + // Back: the bar comes under the pointer again; shown on motion, it then stays. + a.resize(400, 300, 1.0); + a.pointer_motion(Instant::now()); + assert!(a.controls.on_bar && a.controls.hide_at.is_none()); + // Gone from the window: its last place doesn't count. + assert!(a.pointer_moved(&Input::Leave)); + a.pointer_left(Instant::now()); + a.refresh_hover(); + assert!(!a.controls.on_bar, "not on the bar from outside the window"); + } + #[test] fn the_pointer_hides_with_the_bar_while_a_video_plays_and_motion_brings_it_back() { let t = Instant::now(); diff --git a/src/tokens.rs b/src/tokens.rs index 1a00e6a..a5ad9e6 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -383,7 +383,7 @@ pub mod motion { /// After the theme folder changes, how long the viewer waits before reading it, so a theme swap is read once it's whole (src/main.rs). pub const THEME_SETTLE: Duration = Duration::from_millis(15); - /// While a video plays, how long the control bar stays after the pointer last moved or a key was pressed. Paused, ended, loading, failed, music, or a keyboard focus inside the bar: it stays. The mouse pointer hides and comes back with it. + /// While a video plays, how long the control bar stays after the pointer last moved or a key was pressed. Paused, ended, loading, failed, music, a keyboard focus inside the bar, or the pointer resting on the bar: it stays. The mouse pointer hides and comes back with it. pub const CONTROLS_HIDE: Duration = Duration::from_millis(2000); /// How far Left and Right (or a click on the seek bar's keyboard focus) move in a video. From 9a048fcd863a292d57495e57d6e75041c94109a1 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Fri, 4 Dec 2026 09:42:47 -0700 Subject: [PATCH 3/4] ALI-2664: Recheck the pointer when a key shows the bar, and keep its 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. --- src/app.rs | 5 ++++ src/app/player_ui.rs | 56 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1651886..0cc1a76 100644 --- a/src/app.rs +++ b/src/app.rs @@ -236,6 +236,11 @@ impl App { pub fn resize(&mut self, w: u32, h: u32, scale: f64) { let changed = (w, h) != self.win || (scale - self.scale).abs() > 1e-9; + // The pointer is kept in buffer pixels: the same place at the new scale. + if self.scale > 0.0 && (scale - self.scale).abs() > 1e-9 { + let k = scale / self.scale; + self.pointer = (self.pointer.0 * k, self.pointer.1 * k); + } self.win = (w.max(1), h.max(1)); self.scale = scale; self.frame.resize(self.win.0 as usize * self.win.1 as usize, 0); diff --git a/src/app/player_ui.rs b/src/app/player_ui.rs index f80b6cf..b930757 100644 --- a/src/app/player_ui.rs +++ b/src/app/player_ui.rs @@ -54,15 +54,25 @@ impl App { /// Something happened: show the bar, and hide it `controls-hide` later if it may. pub(super) fn poke_controls(&mut self, now: Instant) { - let Some(m) = &self.media else { return }; - let may = may_hide(m.kind, &m.phase(), &self.controls); + if self.media.is_none() { + return; + } if !self.controls.shown { self.controls.shown = true; + // A key can show it under a pointer that hasn't moved since the bar hid. + self.controls.on_bar = self.bar_under_pointer(); self.overlay_all(); } + let may = self.media.as_ref().is_some_and(|m| may_hide(m.kind, &m.phase(), &self.controls)); self.controls.hide_at = may.then(|| now + motion::CONTROLS_HIDE); } + /// Whether the pointer is in the window, where the bar is or would be shown. + fn bar_under_pointer(&mut self) -> bool { + let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); + self.pointer_in && self.bar_layout().is_some_and(|l| l.bar.contains(x, y)) + } + /// The bar's time to hide came: hides it if it still may. pub(super) fn expire_controls(&mut self, now: Instant) { if self.controls.hide_at.is_some_and(|t| now >= t) { @@ -346,8 +356,9 @@ impl App { self.a11y_dirty = true; } - /// Highlights the control under the pointer, if the bar is shown, without counting as - /// motion: for when the bar came or went while the pointer stayed put. + /// Highlights the control under the pointer and notes whether it rests on the bar, if the + /// bar is shown, without counting as motion: for when the bar came, went or moved while the + /// pointer stayed put. Coming onto or off the bar stops or restarts the time to hide. pub(super) fn refresh_hover(&mut self) { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); // Outside the window, the last place it was isn't where it is. @@ -358,7 +369,7 @@ impl App { self.overlay_bar(); } // The bar can move from under a still pointer, or come under it: a resize, new media. - let on_bar = self.controls.shown && l.is_some_and(|l| l.bar.contains(x, y)); + let on_bar = self.controls.shown && self.bar_under_pointer(); self.set_on_bar(on_bar, Instant::now()); } @@ -432,10 +443,10 @@ impl App { fn pointer_motion(&mut self, now: Instant) { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); let was_shown = self.controls.shown; - let l = self.bar_layout(); // Before the poke, so a pointer on the bar keeps it from timing out. - self.controls.on_bar = l.is_some_and(|l| l.bar.contains(x, y)); + self.controls.on_bar = self.bar_under_pointer(); self.poke_controls(now); + let l = self.bar_layout(); if let (Some(c), Some(l)) = (self.controls.drag, l) { self.slide(c, l, x); } @@ -923,6 +934,37 @@ mod tests { assert!(!a.controls.on_bar, "not on the bar from outside the window"); } + #[test] + fn a_key_showing_the_bar_under_a_still_pointer_keeps_it() { + let t = Instant::now(); + let mut a = playing("clip.mp4", false, false); + // Rest on the video, 10 px above the bar, and let both hide. + let bar = a.bar_layout().expect("a bar").bar; + assert!(a.pointer_moved(&Input::Move { x: (bar.x + bar.w / 2) as f64, y: (bar.y - 10) as f64 })); + a.pointer_motion(t); + a.expire_controls(t + motion::CONTROLS_HIDE); + assert!(!a.controls.shown && a.pointer_hidden()); + // Shorter: the hidden bar's place comes under the still pointer. + a.resize(400, 280, 1.0); + assert!(!a.controls.shown && !a.controls.on_bar, "still hidden, so not on it"); + // A key shows it, as Space or an arrow does. + a.poke_controls(t + motion::CONTROLS_HIDE * 2); + assert!(a.controls.shown && a.controls.on_bar && a.controls.hide_at.is_none(), "shown under the pointer, it stays"); + } + + #[test] + fn a_new_scale_keeps_the_pointer_where_it_is() { + let t = Instant::now(); + let mut a = playing("clip.mp4", false, false); + let bar = a.bar_layout().expect("a bar").bar; + assert!(a.pointer_moved(&Input::Move { x: (bar.x + bar.w - 4) as f64, y: (bar.y + bar.h - 2) as f64 })); + a.pointer_motion(t); + assert!(a.controls.on_bar); + // To a monitor at scale 2: the same surface, twice the buffer pixels. + a.resize(800, 600, 2.0); + assert!(a.controls.on_bar && a.controls.hide_at.is_none(), "still on the bar at the new scale"); + } + #[test] fn the_pointer_hides_with_the_bar_while_a_video_plays_and_motion_brings_it_back() { let t = Instant::now(); From 334b8e9e6137eb9af47edc17fb0061446c7d68d5 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Fri, 4 Dec 2026 09:45:03 -0700 Subject: [PATCH 4/4] ALI-2664: Name the pointer-on-the-bar rule in the README, and fix a doc comment --- README.md | 2 +- src/app/player_ui.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc8556e..55532eb 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ keyboard. The control bar hides 2 s after the pointer last moved or a key was pressed while a video plays, in a window and in full screen. It stays while the video is paused or has ended, -for music, and while the keyboard focus is in it. The mouse pointer hides with the bar and +for music, while the keyboard focus is in it, and while the pointer rests on it. The mouse pointer hides with the bar and comes back with it: on any pointer motion, and on a key, a click or a pause. It hides only where the desktop offers cursor-shape-v1, without which its shape couldn't be set again. A video stops on its last frame with a diff --git a/src/app/player_ui.rs b/src/app/player_ui.rs index b930757..e1a5633 100644 --- a/src/app/player_ui.rs +++ b/src/app/player_ui.rs @@ -67,7 +67,7 @@ impl App { self.controls.hide_at = may.then(|| now + motion::CONTROLS_HIDE); } - /// Whether the pointer is in the window, where the bar is or would be shown. + /// Whether the pointer is in the window and over the bar's place, shown or not. fn bar_under_pointer(&mut self) -> bool { let (x, y) = (self.pointer.0 as i32, self.pointer.1 as i32); self.pointer_in && self.bar_layout().is_some_and(|l| l.bar.contains(x, y))