From 0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sat, 15 Feb 2025 14:56:00 +0200 Subject: Checkpoint: preserve all uncommitted rust-rewrite worktree work Safety commit before reconciling this worktree with main, which has diverged with its own separate fixes today. Nothing here is reviewed or curated yet - this exists purely so none of this work can be lost to a git operation, disk issue, or worktree cleanup while that reconciliation happens. --- crates/wayland/src/state/tick.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/wayland/src/state/tick.rs') diff --git a/crates/wayland/src/state/tick.rs b/crates/wayland/src/state/tick.rs index 6ef0ed6..333c30b 100644 --- a/crates/wayland/src/state/tick.rs +++ b/crates/wayland/src/state/tick.rs @@ -34,6 +34,28 @@ impl CompState { } } + /// Forces a fresh `redraw_decoration_buffer` call every frame while the + /// titlebar-button glyph-reveal-on-hover animation is still in + /// progress; called once per redraw from both backends' poll loops, + /// alongside `tick_animations`. Needed for the same reason that one + /// is: `redraw_decoration_buffer`'s own signature-based cache only + /// rebuilds when *called*, and nothing else calls it once a pointer + /// stops moving over an already-hovered button - without this, the + /// glyph would jump straight from invisible to full opacity on the + /// one motion event that started the hover, then never update again + /// for the rest of the animation's own duration, since no further + /// motion event arrives to drive it. Does nothing in `theme. + /// button_glyph_always` mode or once the animation has actually + /// finished (`HOVER_GLYPH_DURATION` elapsed) - both are already a + /// stable, cached final state with nothing left to advance. + pub(crate) fn tick_hover_glyph_animation(&mut self) { + let Some((id, _, start)) = self.hovered_titlebar_button else { return }; + if self.wm.borrow().theme.button_glyph_always || start.elapsed() >= decoration::HOVER_GLYPH_DURATION { + return; + } + self.redraw_decoration_buffer(id); + } + /// Re-applies `WindowManager`'s own stacking order to `Space`, bottom /// to top. /// -- cgit v1.2.3