forge
Explore
Log in

Don't you dare go Hollow

Extract is_laptop_panel() to utils

Browse files at this commit

a778ab38977b99edb79275cf3ad2ddffa24044f7Ivan MolodetskikhParent: 4c2f49d
src/dbus/mutter_display_config.rsmodified+2 -1
@@ -8,6 +8,7 @@ use zbus::{dbus_interface, fdo, SignalContext};
8 8
9 use super::Start;9 use super::Start;
10 use crate::backend::IpcOutputMap;10 use crate::backend::IpcOutputMap;
11+use crate::utils::is_laptop_panel;
11 12
12 pub struct DisplayConfig {13 pub struct DisplayConfig {
13 ipc_outputs: Arc<Mutex<IpcOutputMap>>,14 ipc_outputs: Arc<Mutex<IpcOutputMap>>,
@@ -63,7 +64,7 @@ impl DisplayConfig {
63 .map(|output| {64 .map(|output| {
64 // Loosely matches the check in Mutter.65 // Loosely matches the check in Mutter.
65 let c = &output.name;66 let c = &output.name;
66- let is_laptop_panel = matches!(c.get(..4), Some("eDP-" | "LVDS" | "DSI-"));67+ let is_laptop_panel = is_laptop_panel(c);
67 let display_name = make_display_name(output, is_laptop_panel);68 let display_name = make_display_name(output, is_laptop_panel);
68 69
69 let mut properties = HashMap::new();70 let mut properties = HashMap::new();
src/utils/mod.rsmodified+4 -0
@@ -224,6 +224,10 @@ pub fn output_matches_name(output: &Output, target: &str) -> bool {
224 name.matches(target)224 name.matches(target)
225 }225 }
226 226
227+pub fn is_laptop_panel(connector: &str) -> bool {
228+ matches!(connector.get(..4), Some("eDP-" | "LVDS" | "DSI-"))
229+}
230+
227 pub fn with_toplevel_role<T>(231 pub fn with_toplevel_role<T>(
228 toplevel: &ToplevelSurface,232 toplevel: &ToplevelSurface,
229 f: impl FnOnce(&mut XdgToplevelSurfaceRoleAttributes) -> T,233 f: impl FnOnce(&mut XdgToplevelSurfaceRoleAttributes) -> T,