Skip to content

Remove the Mutex from Animated#129

Merged
pragmatrix merged 3 commits into
masterfrom
simplify-animated
May 26, 2026
Merged

Remove the Mutex from Animated#129
pragmatrix merged 3 commits into
masterfrom
simplify-animated

Conversation

@pragmatrix
Copy link
Copy Markdown
Owner

This is the first step for making the animation system simpler, but it currently has an essential problem which come from the fact that the visor layout depends on the expansion factor, which is an animated value.

@pragmatrix pragmatrix marked this pull request as draft May 22, 2026 05:55
@pragmatrix pragmatrix force-pushed the simplify-animated branch from a8f114e to d5b1e28 Compare May 25, 2026 14:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the internal Mutex from animation::Animated, shifting the API to require mutable access for progressing animations and returning references instead of owned values. It updates downstream call sites (desktop + examples) to dereference returned references or use latest_value() where mutation/progression isn’t desired/possible.

Changes:

  • Refactor Animated<T> to store AnimatedInner<T> directly (no mutex), make value() require &mut self and return &T, and add latest_value() for non-progressing reads.
  • Update desktop presenters/systems and the logs example to accommodate reference-returning getters (*value, *final_value, latest_value()).
  • Adjust camera access to align with the new Animated API (DesktopSystem::camera(&mut self) -> &PixelCamera).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
animation/src/animated.rs Removes mutex-based interior mutability; changes read APIs to return references and requires &mut to progress animations.
desktop/src/desktop.rs Updates camera retrieval to dereference the new &PixelCamera return.
desktop/src/desktop_system.rs Changes camera() accessor signature to return a reference and require &mut self.
desktop/src/desktop_system/layout_effects.rs Updates camera locking and hover placement composition to use dereferenced refs / latest_value().
desktop/src/desktop_system/presentation.rs Updates originating instance transform read to use latest_value().
desktop/src/instance_presenter.rs Updates animation application to dereference Animated::value() results.
desktop/src/projects/launcher_presenter.rs Updates alpha usage and final_value() comparisons for ref-returning APIs.
desktop/src/projects/project_presenter.rs Updates hover alpha usage for ref-returning APIs.
examples/logs/examples/logs.rs Updates animated value reads to dereference refs and uses latest_value() for logging.

Comment thread animation/src/animated.rs
@pragmatrix pragmatrix marked this pull request as ready for review May 26, 2026 06:16
@pragmatrix pragmatrix merged commit a5c88d3 into master May 26, 2026
2 of 5 checks passed
@pragmatrix pragmatrix deleted the simplify-animated branch May 26, 2026 06:16
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.

2 participants