Commit 621e5571 authored by Jeremy Soller's avatar Jeremy Soller

Remove resource_sceme, Fix syscall crate name, add fmap

parent e4b4eb5a
......@@ -7,4 +7,4 @@ bitflags = "*"
dma = { path = "../../crates/dma/" }
io = { path = "../../crates/io/" }
spin = "*"
syscall = { path = "../../syscall/" }
redox_syscall = { path = "../../syscall/" }
......@@ -8,4 +8,4 @@ dma = { path = "../../crates/dma/" }
event = { path = "../../crates/event/" }
io = { path = "../../crates/io/" }
netutils = { path = "../../programs/netutils/" }
syscall = { path = "../../syscall/" }
redox_syscall = { path = "../../syscall/" }
......@@ -3,11 +3,9 @@ name = "pcid"
version = "0.1.0"
[dependencies]
redox_syscall = { path = "../../syscall/" }
rustc-serialize = { git = "https://github.com/redox-os/rustc-serialize.git" }
toml = "*"
[dependencies.syscall]
path = "../../syscall/"
[replace]
"rustc-serialize:0.3.19" = { git = "https://github.com/redox-os/rustc-serialize.git" }
......@@ -7,4 +7,4 @@ bitflags = "*"
event = { path = "../../crates/event/" }
io = { path = "../../crates/io/" }
orbclient = "0.1"
syscall = { path = "../../syscall/" }
redox_syscall = { path = "../../syscall/" }
......@@ -8,4 +8,4 @@ dma = { path = "../../crates/dma/" }
event = { path = "../../crates/event/" }
io = { path = "../../crates/io/" }
netutils = { path = "../../programs/netutils/" }
syscall = { path = "../../syscall/" }
redox_syscall = { path = "../../syscall/" }
......@@ -4,9 +4,9 @@ version = "0.1.0"
[dependencies]
orbclient = "0.1"
ransid = { git = "https://github.com/redox-os/ransid.git" }
ransid = "0.2"
rusttype = { git = "https://github.com/dylanede/rusttype.git", optional = true }
syscall = { path = "../../syscall/" }
redox_syscall = "0.1"
[features]
default = []
......@@ -72,6 +72,14 @@ impl SchemeMut for DisplayScheme {
}
}
fn fmap(&mut self, id: usize, offset: usize, size: usize) -> Result<usize> {
if let Some(screen) = self.screens.get(&id) {
screen.map(offset, size)
} else {
Err(Error::new(EBADF))
}
}
fn fpath(&mut self, id: usize, buf: &mut [u8]) -> Result<usize> {
let path_str = if id == 0 {
format!("display:input")
......
......@@ -45,6 +45,14 @@ impl Screen for GraphicScreen {
Ok(0)
}
fn map(&self, offset: usize, size: usize) -> Result<usize> {
if offset + size <= self.display.offscreen.len() * 4 {
Ok(self.display.offscreen.as_ptr() as usize + offset)
} else {
Err(Error::new(EINVAL))
}
}
fn input(&mut self, event: &Event) {
if let EventOption::Mouse(mut mouse_event) = event.to_option() {
let x = cmp::max(0, cmp::min(self.display.width as i32, self.mouse_x + mouse_event.x));
......
......@@ -14,6 +14,8 @@ pub trait Screen {
fn event(&mut self, flags: usize) -> Result<usize>;
fn map(&self, offset: usize, size: usize) -> Result<usize>;
fn input(&mut self, event: &Event);
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
......
......@@ -3,7 +3,7 @@ extern crate ransid;
use std::collections::{BTreeSet, VecDeque};
use orbclient::{Event, EventOption};
use syscall::Result;
use syscall::error::*;
use display::Display;
use screen::Screen;
......@@ -48,6 +48,10 @@ impl Screen for TextScreen {
Ok(0)
}
fn map(&self, offset: usize, size: usize) -> Result<usize> {
Err(Error::new(EBADF))
}
fn input(&mut self, event: &Event) {
let mut buf = vec![];
......
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