Read actual BGA resolution when updating display resolution

This commit is contained in:
Jeremy Soller
2022-08-27 17:16:15 -06:00
parent 86b065d724
commit 83e7da750d
2 changed files with 14 additions and 6 deletions
+2
View File
@@ -41,6 +41,8 @@ fn main() {
display: File::open("display:input").ok()
};
scheme.update_size();
syscall::setrens(0, 0).expect("bgad: failed to enter null namespace");
daemon.ready().expect("bgad: failed to notify parent");
+12 -6
View File
@@ -11,6 +11,17 @@ pub struct BgaScheme {
pub display: Option<File>,
}
impl BgaScheme {
pub fn update_size(&mut self) {
if let Some(ref mut display) = self.display {
let _ = display.write(&orbclient::ResizeEvent {
width: self.bga.width() as u32,
height: self.bga.height() as u32,
}.to_event());
}
}
}
impl SchemeMut for BgaScheme {
fn open(&mut self, _path: &str, _flags: usize, uid: u32, _gid: u32) -> Result<usize> {
if uid == 0 {
@@ -58,12 +69,7 @@ impl SchemeMut for BgaScheme {
self.bga.set_size(width, height);
if let Some(ref mut display) = self.display {
let _ = display.write(&orbclient::ResizeEvent {
width: width as u32,
height: height as u32,
}.to_event());
}
self.update_size();
Ok(buf.len())
}