Split update_render_elements() from advance_animations()

advance_animations() is called from places like input, whereas
update_render_elements() is strictly for rendering.
This commit is contained in:
Ivan Molodetskikh
2024-05-04 11:10:02 +04:00
parent 69aeba2a4d
commit 73cc0079d6
9 changed files with 225 additions and 175 deletions
+25 -8
View File
@@ -1354,23 +1354,40 @@ impl<W: LayoutElement> Layout<W> {
let _span = tracy_client::span!("Layout::advance_animations");
match &mut self.monitor_set {
MonitorSet::Normal {
monitors,
active_monitor_idx,
..
} => {
for (idx, mon) in monitors.iter_mut().enumerate() {
mon.advance_animations(current_time, idx == *active_monitor_idx);
MonitorSet::Normal { monitors, .. } => {
for mon in monitors {
mon.advance_animations(current_time);
}
}
MonitorSet::NoOutputs { workspaces, .. } => {
for ws in workspaces {
ws.advance_animations(current_time, false);
ws.advance_animations(current_time);
}
}
}
}
pub fn update_render_elements(&mut self, output: &Output) {
let _span = tracy_client::span!("Layout::update_render_elements");
let MonitorSet::Normal {
monitors,
active_monitor_idx,
..
} = &mut self.monitor_set
else {
error!("update_render_elements called with no monitors");
return;
};
for (idx, mon) in monitors.iter_mut().enumerate() {
if mon.output == *output {
mon.update_render_elements(idx == *active_monitor_idx);
return;
}
}
}
pub fn update_shaders(&mut self) {
match &mut self.monitor_set {
MonitorSet::Normal { monitors, .. } => {