aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-23 11:27:27 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-23 15:09:16 +0300
commit9c7e8d04d27d2f914ad3e9a54c64b64c34aea4d4 (patch)
tree6e22bcba2ea3887525adf68a225f6e2973be26d6 /src
parent1e6b8906e0a04d92778e5a77d97353f768635274 (diff)
downloadniri-9c7e8d04d27d2f914ad3e9a54c64b64c34aea4d4.tar.gz
niri-9c7e8d04d27d2f914ad3e9a54c64b64c34aea4d4.tar.bz2
niri-9c7e8d04d27d2f914ad3e9a54c64b64c34aea4d4.zip
Extract Niri::advance_animations()
Diffstat (limited to 'src')
-rw-r--r--src/input/mod.rs2
-rw-r--r--src/niri.rs36
2 files changed, 20 insertions, 18 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 864bfe7f..976f51db 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -87,7 +87,7 @@ impl State {
// doesn't always trigger due to damage, etc. So run it here right before it might prove
// important. Besides, animations affect the input, so it's best to have up-to-date values
// here.
- self.niri.layout.advance_animations(get_monotonic_time());
+ self.niri.advance_animations(get_monotonic_time());
if self.niri.monitors_active {
// Notify the idle-notifier of activity.
diff --git a/src/niri.rs b/src/niri.rs
index 40c8ae25..7a579761 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -3036,6 +3036,22 @@ impl Niri {
}
}
+ pub fn advance_animations(&mut self, target_time: Duration) {
+ self.layout.advance_animations(target_time);
+ self.config_error_notification
+ .advance_animations(target_time);
+ self.screenshot_ui.advance_animations(target_time);
+
+ for state in self.output_state.values_mut() {
+ if let Some(transition) = &mut state.screen_transition {
+ transition.advance_animations(target_time);
+ if transition.is_done() {
+ state.screen_transition = None;
+ }
+ }
+ }
+ }
+
pub fn update_render_elements(&mut self, output: Option<&Output>) {
self.layout.update_render_elements(output);
@@ -3243,34 +3259,20 @@ impl Niri {
let mut res = RenderResult::Skipped;
if self.monitors_active {
// Update from the config and advance the animations.
- self.layout.advance_animations(target_presentation_time);
-
- if let Some(transition) = &mut state.screen_transition {
- transition.advance_animations(target_presentation_time);
- if transition.is_done() {
- state.screen_transition = None;
- }
- }
+ self.advance_animations(target_presentation_time);
+ let state = self.output_state.get_mut(output).unwrap();
state.unfinished_animations_remain = self.layout.are_animations_ongoing(Some(output));
-
- self.config_error_notification
- .advance_animations(target_presentation_time);
state.unfinished_animations_remain |=
self.config_error_notification.are_animations_ongoing();
-
- self.screenshot_ui
- .advance_animations(target_presentation_time);
state.unfinished_animations_remain |= self.screenshot_ui.are_animations_ongoing();
+ state.unfinished_animations_remain |= state.screen_transition.is_some();
// Also keep redrawing if the current cursor is animated.
state.unfinished_animations_remain |= self
.cursor_manager
.is_current_cursor_animated(output.current_scale().integer_scale());
- // Also keep redrawing during a screen transition.
- state.unfinished_animations_remain |= state.screen_transition.is_some();
-
self.update_render_elements(Some(output));
// Render.