diff options
| author | srdusr <[email protected]> | 2025-02-15 14:56:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-02-15 14:56:00 +0200 |
| commit | 0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd (patch) | |
| tree | 7672d0af277664f457c6c9462925c0005fe35dcf /crates/wayland/src/state/tick.rs | |
| parent | 413daa7ba2ea0ebd1424c024fd0566423aaea3f8 (diff) | |
| download | srdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.tar.gz srdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.zip | |
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.
Diffstat (limited to 'crates/wayland/src/state/tick.rs')
| -rw-r--r-- | crates/wayland/src/state/tick.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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. /// |