mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-08 03:43:25 +02:00
fix(wm): handle monitor index pref edge case
This commit handles an edge case where the first registered display monitor has an index preference that is greater than the current length of the Ring data structure storing the monitors. re #612
This commit is contained in:
@@ -110,14 +110,16 @@ pub extern "system" fn enum_display_monitor(
|
||||
|
||||
let display_index_preferences = DISPLAY_INDEX_PREFERENCES.lock();
|
||||
for (index, device) in &*display_index_preferences {
|
||||
if let Some(known_device) = m.device() {
|
||||
if let Some(known_device) = m.device_id() {
|
||||
if device == known_device {
|
||||
index_preference = Option::from(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(preference) = index_preference {
|
||||
if monitors.elements().is_empty() {
|
||||
monitors.elements_mut().push_back(m);
|
||||
} else if let Some(preference) = index_preference {
|
||||
let current_len = monitors.elements().len();
|
||||
if *preference > current_len {
|
||||
monitors.elements_mut().reserve(1);
|
||||
|
||||
Reference in New Issue
Block a user