Reduce allocation overhead when advancing animations
This commit is contained in:
1 parent
a02925b2ee
commit
1cad509275
1 file changed
+18
-12
+18
-12
@@ -1855,12 +1855,15 @@ impl Ferese {
|
|||||||
|
|
||||||
fn advance_animations_by(&mut self, delta: std::time::Duration) -> bool {
|
fn advance_animations_by(&mut self, delta: std::time::Duration) -> bool {
|
||||||
let delta = delta.mul_f64(self.animation_speed);
|
let delta = delta.mul_f64(self.animation_speed);
|
||||||
let visible_workspaces = self
|
let visible_workspaces = if self.viewport_animations.is_empty() {
|
||||||
.space
|
HashSet::new()
|
||||||
.outputs()
|
} else {
|
||||||
.filter_map(|output| self.output_ids.get(output))
|
self.space
|
||||||
.filter_map(|output| self.output_workspaces.active_workspace(*output))
|
.outputs()
|
||||||
.collect::<HashSet<_>>();
|
.filter_map(|output| self.output_ids.get(output))
|
||||||
|
.filter_map(|output| self.output_workspaces.active_workspace(*output))
|
||||||
|
.collect::<HashSet<_>>()
|
||||||
|
};
|
||||||
let windows = self
|
let windows = self
|
||||||
.space
|
.space
|
||||||
.elements()
|
.elements()
|
||||||
@@ -1897,12 +1900,15 @@ impl Ferese {
|
|||||||
};
|
};
|
||||||
let mut dim_changed = false;
|
let mut dim_changed = false;
|
||||||
// Include hidden workspace windows: overview can present them too.
|
// Include hidden workspace windows: overview can present them too.
|
||||||
for id in self.window_ids.values().copied().collect::<Vec<_>>() {
|
// Read selection once so these immutable fields can be borrowed alongside
|
||||||
let selected = if self.overview.is_active() {
|
// window_focus without allocating a temporary window-ID vector.
|
||||||
self.overview_selected(id)
|
let selected_window = if self.overview.is_active() {
|
||||||
} else {
|
self.overview.selected()
|
||||||
self.focused_window == Some(id)
|
} else {
|
||||||
};
|
self.focused_window
|
||||||
|
};
|
||||||
|
for id in self.window_ids.values().copied() {
|
||||||
|
let selected = selected_window == Some(id);
|
||||||
let target = if selected { 1.0 } else { 0.0 };
|
let target = if selected { 1.0 } else { 0.0 };
|
||||||
let focus = self
|
let focus = self
|
||||||
.window_focus
|
.window_focus
|
||||||
|
|||||||
Reference in new issue
Block a user