aboutsummaryrefslogtreecommitdiff
path: root/src/ui/config_error_notification.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-23 11:27:27 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-25 04:07:59 -0800
commit93cee2994ab9ccf59a09f61d5b8acf6cd937d654 (patch)
treefb00cdb266e9e94891f226558cd93a09e0091d69 /src/ui/config_error_notification.rs
parent9c7e8d04d27d2f914ad3e9a54c64b64c34aea4d4 (diff)
downloadniri-93cee2994ab9ccf59a09f61d5b8acf6cd937d654.tar.gz
niri-93cee2994ab9ccf59a09f61d5b8acf6cd937d654.tar.bz2
niri-93cee2994ab9ccf59a09f61d5b8acf6cd937d654.zip
Refactor animations to take explicit current time
Diffstat (limited to 'src/ui/config_error_notification.rs')
-rw-r--r--src/ui/config_error_notification.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ui/config_error_notification.rs b/src/ui/config_error_notification.rs
index c4ca3b69..af4f67e3 100644
--- a/src/ui/config_error_notification.rs
+++ b/src/ui/config_error_notification.rs
@@ -14,7 +14,7 @@ use smithay::output::Output;
use smithay::reexports::gbm::Format as Fourcc;
use smithay::utils::{Point, Transform};
-use crate::animation::Animation;
+use crate::animation::{Animation, Clock};
use crate::render_helpers::primary_gpu_texture::PrimaryGpuTextureRenderElement;
use crate::render_helpers::renderer::NiriRenderer;
use crate::render_helpers::texture::{TextureBuffer, TextureRenderElement};
@@ -35,6 +35,7 @@ pub struct ConfigErrorNotification {
// notification.
created_path: Option<PathBuf>,
+ clock: Clock,
config: Rc<RefCell<Config>>,
}
@@ -46,18 +47,25 @@ enum State {
}
impl ConfigErrorNotification {
- pub fn new(config: Rc<RefCell<Config>>) -> Self {
+ pub fn new(clock: Clock, config: Rc<RefCell<Config>>) -> Self {
Self {
state: State::Hidden,
buffers: RefCell::new(HashMap::new()),
created_path: None,
+ clock,
config,
}
}
fn animation(&self, from: f64, to: f64) -> Animation {
let c = self.config.borrow();
- Animation::new(from, to, 0., c.animations.config_notification_open_close.0)
+ Animation::new(
+ self.clock.now(),
+ from,
+ to,
+ 0.,
+ c.animations.config_notification_open_close.0,
+ )
}
pub fn show_created(&mut self, created_path: PathBuf) {