Commit 4e40c1c8 authored by Jeremy Soller's avatar Jeremy Soller

Add method for resizing display

parent 770a23ef
......@@ -63,6 +63,7 @@ dependencies = [
name = "bgad"
version = "0.1.0"
dependencies = [
"orbclient 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
......
......@@ -3,4 +3,5 @@ name = "bgad"
version = "0.1.0"
[dependencies]
orbclient = "0.3"
redox_syscall = "0.1"
#![deny(warnings)]
extern crate orbclient;
extern crate syscall;
use std::env;
......@@ -35,7 +36,10 @@ fn main() {
let mut bga = Bga::new();
print!("{}", format!(" - BGA {}x{}\n", bga.width(), bga.height()));
let mut scheme = BgaScheme { bga: bga };
let mut scheme = BgaScheme {
bga: bga,
display: File::open("display:input").ok()
};
loop {
let mut packet = Packet::default();
socket.read(&mut packet).expect("bgad: failed to read events from bga scheme");
......
use orbclient;
use std::fs::File;
use std::io::Write;
use std::str;
use syscall::{Error, Result, SchemeMut, EACCES, EINVAL, MODE_CHR};
use syscall::data::Stat;
use bga::Bga;
pub struct BgaScheme {
pub bga: Bga
pub bga: Bga,
pub display: Option<File>,
}
impl SchemeMut for BgaScheme {
......@@ -56,6 +59,13 @@ 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());
}
Ok(buf.len())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment