mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Unname connector if a duplicate is detected
This commit is contained in:
+22
-1
@@ -649,13 +649,34 @@ impl Tty {
|
|||||||
crtc: Some(crtc),
|
crtc: Some(crtc),
|
||||||
} => {
|
} => {
|
||||||
let connector_name = format_connector_name(&connector);
|
let connector_name = format_connector_name(&connector);
|
||||||
let name = make_output_name(&device.drm, connector.handle(), connector_name);
|
let mut name =
|
||||||
|
make_output_name(&device.drm, connector.handle(), connector_name);
|
||||||
debug!(
|
debug!(
|
||||||
"new connector: {} \"{}\"",
|
"new connector: {} \"{}\"",
|
||||||
&name.connector,
|
&name.connector,
|
||||||
name.format_make_model_serial(),
|
name.format_make_model_serial(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Make/model/serial can match exactly between different physical monitors. This
|
||||||
|
// doesn't happen often, but our Layout does not support such duplicates and
|
||||||
|
// will panic.
|
||||||
|
//
|
||||||
|
// As a workaround, search for duplicates, and unname the current connector if
|
||||||
|
// one is found. Connector names are always unique.
|
||||||
|
let formatted = name.format_make_model_serial_or_connector();
|
||||||
|
for info in device.known_crtcs.values() {
|
||||||
|
if info.name.matches(&formatted) {
|
||||||
|
warn!("connector make/model/serial duplicates existing, unnaming");
|
||||||
|
name = OutputName {
|
||||||
|
connector: name.connector,
|
||||||
|
make: None,
|
||||||
|
model: None,
|
||||||
|
serial: None,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Assign an id to this crtc.
|
// Assign an id to this crtc.
|
||||||
let id = OutputId::next();
|
let id = OutputId::next();
|
||||||
device.known_crtcs.insert(crtc, CrtcInfo { id, name });
|
device.known_crtcs.insert(crtc, CrtcInfo { id, name });
|
||||||
|
|||||||
Reference in New Issue
Block a user