layout: Return bool from activate_window()

Avoid an extra has_window() call.
This commit is contained in:
Ivan Molodetskikh
2024-12-08 09:15:10 +03:00
parent a2b27b8790
commit 27e607ab82
3 changed files with 10 additions and 10 deletions
+7 -6
View File
@@ -1175,16 +1175,17 @@ impl<W: LayoutElement> ScrollingSpace<W> {
(from_view_offset - new_view_offset).abs() / self.working_area.size.w
}
pub fn activate_window(&mut self, window: &W::Id) {
let column_idx = self
.columns
.iter()
.position(|col| col.contains(window))
.unwrap();
pub fn activate_window(&mut self, window: &W::Id) -> bool {
let column_idx = self.columns.iter().position(|col| col.contains(window));
let Some(column_idx) = column_idx else {
return false;
};
let column = &mut self.columns[column_idx];
column.activate_window(window);
self.activate_column(column_idx);
true
}
pub fn start_close_animation_for_window(