mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-15 21:32:26 +01: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:
1 parent
d3bc78097c
commit
e221d96785
1 file changed
+4
-2
@@ -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