Compare commits
2 Commits
14f077ff97
...
c06cd2d999
Author | SHA1 | Date |
---|---|---|
mars | c06cd2d999 | |
mars | 780f13a015 |
|
@ -26,6 +26,7 @@ pub struct CreatePanel {
|
|||
pub id: PanelId,
|
||||
pub protocol: String,
|
||||
pub script: PathBuf,
|
||||
pub init_msg: Vec<u8>,
|
||||
}
|
||||
|
||||
/// Sends a panel a message.
|
||||
|
|
|
@ -130,6 +130,7 @@ impl Client {
|
|||
id,
|
||||
protocol,
|
||||
script,
|
||||
init_msg,
|
||||
}) => {
|
||||
let mut data = self.data.write();
|
||||
|
||||
|
@ -146,6 +147,7 @@ impl Client {
|
|||
id: window,
|
||||
protocol,
|
||||
script,
|
||||
init_msg,
|
||||
};
|
||||
let _ = self.window_sender.send_event(msg);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ pub enum WindowMessage {
|
|||
id: usize,
|
||||
protocol: String,
|
||||
script: PathBuf,
|
||||
init_msg: Vec<u8>,
|
||||
},
|
||||
CloseWindow {
|
||||
id: usize,
|
||||
|
@ -194,11 +195,12 @@ impl WindowStore {
|
|||
id,
|
||||
protocol,
|
||||
script,
|
||||
init_msg,
|
||||
} => {
|
||||
println!("Opening window {} with script {:?}", id, script);
|
||||
let module = std::fs::read(script)?;
|
||||
let mut script = self.runtime.load_module(&module)?;
|
||||
let panel = script.create_panel(&protocol, vec![])?;
|
||||
let panel = script.create_panel(&protocol, init_msg)?;
|
||||
let window = Window::new(self.ipc_sender.to_owned(), id, panel, &event_loop)?;
|
||||
let window_id = window.get_id();
|
||||
self.windows.insert(window_id, window);
|
||||
|
|
|
@ -205,6 +205,7 @@ fn main() {
|
|||
id: 0,
|
||||
protocol,
|
||||
script,
|
||||
init_msg: vec![],
|
||||
};
|
||||
|
||||
let msg = MagpieServerMsg::CreatePanel(msg);
|
||||
|
|
Loading…
Reference in New Issue