Commit 9eb092a2 authored by Jeremy Soller's avatar Jeremy Soller

Significant improvements for events - switch to event queue in orbital

parent e089cffc
......@@ -6,10 +6,10 @@ extern crate alloc;
extern crate orbclient;
extern crate syscall;
use std::{env, thread};
use std::{env, mem, thread};
use std::fs::File;
use std::io::{Read, Write};
use syscall::{physmap, physunmap, Packet, Scheme, MAP_WRITE, MAP_WRITE_COMBINE};
use syscall::{physmap, physunmap, Packet, Scheme, EVENT_READ, MAP_WRITE, MAP_WRITE_COMBINE};
use mode_info::VBEModeInfo;
use primitive::fast_set64;
......@@ -87,22 +87,22 @@ fn main() {
}
}
// If there are requested events, and data is available, send a notification
/* TODO
if (! scheme.screen.borrow().input.is_empty() || scheme.screen.borrow().end_of_input) && scheme.screen.borrow().requested & EVENT_READ == EVENT_READ {
let event_packet = Packet {
id: 0,
pid: 0,
uid: 0,
gid: 0,
a: syscall::number::SYS_FEVENT,
b: 0,
c: EVENT_READ,
d: scheme.screen.borrow().input.len()
};
socket.write(&event_packet).expect("vesad: failed to write display scheme");
for (screen_id, screen) in scheme.screens.borrow().iter() {
if ! screen.will_block() {
let event_packet = Packet {
id: 0,
pid: 0,
uid: 0,
gid: 0,
a: syscall::number::SYS_FEVENT,
b: *screen_id,
c: EVENT_READ,
d: mem::size_of::<Packet>()
};
socket.write(&event_packet).expect("vesad: failed to write display event");
}
}
*/
}
});
}
......
......@@ -14,7 +14,7 @@ pub struct DisplayScheme {
onscreen: usize,
active: Cell<usize>,
next_screen: Cell<usize>,
screens: RefCell<BTreeMap<usize, Box<Screen>>>
pub screens: RefCell<BTreeMap<usize, Box<Screen>>>
}
impl DisplayScheme {
......@@ -77,7 +77,7 @@ impl Scheme for DisplayScheme {
fn fevent(&self, id: usize, flags: usize) -> Result<usize> {
let mut screens = self.screens.borrow_mut();
if let Some(mut screen) = screens.get_mut(&id) {
screen.event(flags)
screen.event(flags).and(Ok(id))
} else {
Err(Error::new(EBADF))
}
......
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