From 73cc0079d628e66b1d64168ed1a10b13b23ab5d0 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 4 May 2024 11:10:02 +0400 Subject: Split update_render_elements() from advance_animations() advance_animations() is called from places like input, whereas update_render_elements() is strictly for rendering. --- src/layout/mod.rs | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index b670b9f5..b93dfb4d 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1354,23 +1354,40 @@ impl Layout { 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, .. } => { -- cgit