feat(display): windows: full-screen, F1 cycles, OS bar (names, front, user); canvas-only (display-owned buffers, 4 max, reused); launchers OPEN (pm per app, terminal own), window caps minted by display; FORGET on launcher death via init courier; raster crate (font, chunked text); F-keys in input; terminal+snake on canvas; REDRAW gone
This commit is contained in:
@@ -43,6 +43,8 @@ struct Running {
|
||||
granted: Capabilities,
|
||||
/// Its data folder grant, taken back when it dies.
|
||||
data: Option<CapSlot>,
|
||||
/// Its window, closed when it dies.
|
||||
window: Option<CapSlot>,
|
||||
}
|
||||
|
||||
pub struct PermissionServer {
|
||||
@@ -177,13 +179,19 @@ impl PermissionServer {
|
||||
true => self.store.data_grant(&plan.app.id),
|
||||
false => None,
|
||||
};
|
||||
// Opened here, named from its manifest: the app cannot name its own.
|
||||
let window = match plan.granted.contains(Capability::Display) {
|
||||
true => self.display.and_then(|d| libkos::display::open(d, plan.app.name.as_str().as_bytes())).map(|o| o.window),
|
||||
false => None,
|
||||
};
|
||||
let staged = (badge == self.staged.badge).then_some(&self.staged);
|
||||
let arg = StartArg {
|
||||
log: staged.and_then(|s| s.output).and_then(|o| child.give(o, call)).or(child.log()),
|
||||
storage: staged.and_then(|s| s.folder).and_then(|f| child.give(f, call)),
|
||||
data: data.and_then(|d| child.give(d, call)),
|
||||
// It subscribes to input by sending the display a notification.
|
||||
display: self.display.filter(|_| plan.granted.contains(Capability::Display)).and_then(|d| child.give_sending(d, call)),
|
||||
// Delegate, to send its notification when it subscribes.
|
||||
display: window.and_then(|w| child.give_sending(w, call)),
|
||||
args: child.set_args(args),
|
||||
console: None,
|
||||
};
|
||||
@@ -193,10 +201,11 @@ impl PermissionServer {
|
||||
if let Some(d) = data {
|
||||
let _ = libkos::fs::release(d);
|
||||
}
|
||||
close_window(window);
|
||||
syscall::drop_cap(child.process);
|
||||
return Err(code(reply::FAILED));
|
||||
}
|
||||
self.running[index] = Some(Running { id: plan.app.id, process: child.process, granted: plan.granted, data });
|
||||
self.running[index] = Some(Running { id: plan.app.id, process: child.process, granted: plan.granted, data, window });
|
||||
Ok((child.process, plan.granted))
|
||||
}
|
||||
|
||||
@@ -271,6 +280,7 @@ impl PermissionServer {
|
||||
if let Some(d) = r.data {
|
||||
let _ = libkos::fs::release(d);
|
||||
}
|
||||
close_window(r.window);
|
||||
syscall::drop_cap(r.process);
|
||||
}
|
||||
}
|
||||
@@ -331,3 +341,10 @@ impl Server for PermissionServer {
|
||||
self.reap(bits);
|
||||
}
|
||||
}
|
||||
|
||||
fn close_window(window: Option<CapSlot>) {
|
||||
if let Some(w) = window {
|
||||
libkos::display::close(w);
|
||||
syscall::drop_cap(w);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user