fix(wm): grow monitors vec to accomodate idx prefs

This commit fixes a bug in load_monitor_information which resulted in an
infinite while loop due to a misunderstanding of how VecDeque::reserve
works.
This commit is contained in:
LGUG2Z
2024-08-27 16:21:59 -07:00
parent b799fd3077
commit c06d9afa3b
2 changed files with 21 additions and 1 deletions
+16
View File
@@ -88,6 +88,22 @@ pub fn new(
}
impl Monitor {
pub fn placeholder() -> Self {
Self {
id: 0,
name: "PLACEHOLDER".to_string(),
device: "".to_string(),
device_id: "".to_string(),
size: Default::default(),
work_area_size: Default::default(),
work_area_offset: None,
window_based_work_area_offset: None,
window_based_work_area_offset_limit: 0,
workspaces: Default::default(),
last_focused_workspace: None,
workspace_names: Default::default(),
}
}
pub fn load_focused_workspace(&mut self, mouse_follows_focus: bool) -> Result<()> {
let focused_idx = self.focused_workspace_idx();
for (i, workspace) in self.workspaces_mut().iter_mut().enumerate() {