1
0
Fork 0
forked from wry/wry

config: move output schema into schema crate

This commit is contained in:
kossLAN 2026-05-29 17:04:27 -04:00
parent e94d8fec1f
commit fb65585bfa
No known key found for this signature in database
4 changed files with 140 additions and 93 deletions

View file

@ -538,7 +538,11 @@ fn apply_recursive_match<'a, U>(
}
}
impl ConfigDrmDevice {
trait ConfigDrmDeviceExt {
fn apply(&self, d: DrmDevice);
}
impl ConfigDrmDeviceExt for ConfigDrmDevice {
fn apply(&self, d: DrmDevice) {
if let Some(api) = self.gfx_api {
d.set_gfx_api(api);
@ -552,7 +556,18 @@ impl ConfigDrmDevice {
}
}
impl DrmDeviceMatch {
trait DrmDeviceMatchExt {
fn matches(&self, d: DrmDevice, state: &State) -> bool;
fn matches_<'a>(
&'a self,
d: DrmDevice,
state: &'a State,
active: &mut AHashSet<&'a str>,
) -> bool;
}
impl DrmDeviceMatchExt for DrmDeviceMatch {
fn matches(&self, d: DrmDevice, state: &State) -> bool {
self.matches_(d, state, &mut AHashSet::new())
}
@ -754,7 +769,18 @@ impl Input {
}
}
impl OutputMatch {
trait OutputMatchExt {
fn matches(&self, c: Connector, state: &State) -> bool;
fn matches_<'a>(
&'a self,
c: Connector,
state: &'a State,
active: &mut AHashSet<&'a str>,
) -> bool;
}
impl OutputMatchExt for OutputMatch {
fn matches(&self, c: Connector, state: &State) -> bool {
if !c.connected() {
return false;
@ -815,7 +841,11 @@ impl OutputMatch {
}
}
impl ConnectorMatch {
trait ConnectorMatchExt {
fn matches(&self, c: Connector) -> bool;
}
impl ConnectorMatchExt for ConnectorMatch {
fn matches(&self, c: Connector) -> bool {
if !c.exists() {
return false;
@ -834,13 +864,21 @@ impl ConnectorMatch {
}
}
impl ConfigConnector {
trait ConfigConnectorExt {
fn apply(&self, c: Connector);
}
impl ConfigConnectorExt for ConfigConnector {
fn apply(&self, c: Connector) {
c.set_enabled(self.enabled);
}
}
impl Output {
trait OutputExt {
fn apply(&self, c: Connector);
}
impl OutputExt for Output {
fn apply(&self, c: Connector) {
if self.x.is_some() || self.y.is_some() {
let (old_x, old_y) = c.position();