Extract is_laptop_panel() to utils

This commit is contained in:
Ivan Molodetskikh
2024-11-05 09:40:12 +03:00
parent 4c2f49d566
commit a778ab3897
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ use zbus::{dbus_interface, fdo, SignalContext};
use super::Start;
use crate::backend::IpcOutputMap;
use crate::utils::is_laptop_panel;
pub struct DisplayConfig {
ipc_outputs: Arc<Mutex<IpcOutputMap>>,
@@ -63,7 +64,7 @@ impl DisplayConfig {
.map(|output| {
// Loosely matches the check in Mutter.
let c = &output.name;
let is_laptop_panel = matches!(c.get(..4), Some("eDP-" | "LVDS" | "DSI-"));
let is_laptop_panel = is_laptop_panel(c);
let display_name = make_display_name(output, is_laptop_panel);
let mut properties = HashMap::new();
+4
View File
@@ -224,6 +224,10 @@ pub fn output_matches_name(output: &Output, target: &str) -> bool {
name.matches(target)
}
pub fn is_laptop_panel(connector: &str) -> bool {
matches!(connector.get(..4), Some("eDP-" | "LVDS" | "DSI-"))
}
pub fn with_toplevel_role<T>(
toplevel: &ToplevelSurface,
f: impl FnOnce(&mut XdgToplevelSurfaceRoleAttributes) -> T,