1
0
Fork 0
forked from wry/wry

metal: send non-desktop outputs to the frontend

This commit is contained in:
Julian Orth 2024-04-25 16:31:29 +02:00
parent fa3d870935
commit 24d08918c4
11 changed files with 184 additions and 62 deletions

View file

@ -217,6 +217,7 @@ struct Output {
pub height_mm: i32,
pub current_mode: Option<Mode>,
pub modes: Vec<Mode>,
pub non_desktop: bool,
}
#[derive(Copy, Clone, Debug)]
@ -479,12 +480,16 @@ impl Randr {
println!(" product: {}", o.product);
println!(" manufacturer: {}", o.manufacturer);
println!(" serial number: {}", o.serial_number);
println!(" position: {} x {}", o.x, o.y);
println!(" logical size: {} x {}", o.width, o.height);
println!(
" physical size: {}mm x {}mm",
o.width_mm, o.height_mm
);
if o.non_desktop {
println!(" non-desktop");
return;
}
println!(" position: {} x {}", o.x, o.y);
println!(" logical size: {} x {}", o.width, o.height);
if let Some(mode) = &o.current_mode {
print!(" mode: ");
self.print_mode(mode, false);
@ -570,6 +575,27 @@ impl Randr {
height_mm: msg.height_mm,
modes: Default::default(),
current_mode: None,
non_desktop: false,
});
});
jay_randr::NonDesktopOutput::handle(tc, randr, data.clone(), |data, msg| {
let mut data = data.borrow_mut();
let c = data.connectors.last_mut().unwrap();
c.output = Some(Output {
scale: 1.0,
width: 0,
height: 0,
x: 0,
y: 0,
transform: Transform::None,
manufacturer: msg.manufacturer.to_string(),
product: msg.product.to_string(),
serial_number: msg.serial_number.to_string(),
width_mm: msg.width_mm,
height_mm: msg.height_mm,
modes: Default::default(),
current_mode: None,
non_desktop: true,
});
});
jay_randr::Mode::handle(tc, randr, data.clone(), |data, msg| {