utils: Abstract built-in output check
This commit is contained in:
parent
d6c1ca8c33
commit
8648d4450e
2 changed files with 7 additions and 4 deletions
|
|
@ -2042,10 +2042,7 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn builtin_output(&self) -> Option<&Output> {
|
pub fn builtin_output(&self) -> Option<&Output> {
|
||||||
self.outputs().find(|output| {
|
self.outputs().find(|output| output.is_internal())
|
||||||
let name = output.name();
|
|
||||||
name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn global_space(&self) -> Rectangle<i32, Global> {
|
pub fn global_space(&self) -> Rectangle<i32, Global> {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait OutputExt {
|
pub trait OutputExt {
|
||||||
|
fn is_internal(&self) -> bool;
|
||||||
fn geometry(&self) -> Rectangle<i32, Global>;
|
fn geometry(&self) -> Rectangle<i32, Global>;
|
||||||
fn zoomed_geometry(&self) -> Option<Rectangle<i32, Global>>;
|
fn zoomed_geometry(&self) -> Option<Rectangle<i32, Global>>;
|
||||||
|
|
||||||
|
|
@ -44,6 +45,11 @@ struct VrrSupport(AtomicU8);
|
||||||
struct Mirroring(Mutex<Option<WeakOutput>>);
|
struct Mirroring(Mutex<Option<WeakOutput>>);
|
||||||
|
|
||||||
impl OutputExt for Output {
|
impl OutputExt for Output {
|
||||||
|
fn is_internal(&self) -> bool {
|
||||||
|
let name = self.name();
|
||||||
|
name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-")
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> Rectangle<i32, Global> {
|
fn geometry(&self) -> Rectangle<i32, Global> {
|
||||||
Rectangle::new(self.current_location(), {
|
Rectangle::new(self.current_location(), {
|
||||||
Transform::from(self.current_transform())
|
Transform::from(self.current_transform())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue