Add init_msg to Magpie CreatePanel message
This commit is contained in:
parent
14f077ff97
commit
780f13a015
|
@ -26,6 +26,7 @@ pub struct CreatePanel {
|
||||||
pub id: PanelId,
|
pub id: PanelId,
|
||||||
pub protocol: String,
|
pub protocol: String,
|
||||||
pub script: PathBuf,
|
pub script: PathBuf,
|
||||||
|
pub init_msg: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends a panel a message.
|
/// Sends a panel a message.
|
||||||
|
|
|
@ -130,6 +130,7 @@ impl Client {
|
||||||
id,
|
id,
|
||||||
protocol,
|
protocol,
|
||||||
script,
|
script,
|
||||||
|
init_msg,
|
||||||
}) => {
|
}) => {
|
||||||
let mut data = self.data.write();
|
let mut data = self.data.write();
|
||||||
|
|
||||||
|
@ -146,6 +147,7 @@ impl Client {
|
||||||
id: window,
|
id: window,
|
||||||
protocol,
|
protocol,
|
||||||
script,
|
script,
|
||||||
|
init_msg,
|
||||||
};
|
};
|
||||||
let _ = self.window_sender.send_event(msg);
|
let _ = self.window_sender.send_event(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub enum WindowMessage {
|
||||||
id: usize,
|
id: usize,
|
||||||
protocol: String,
|
protocol: String,
|
||||||
script: PathBuf,
|
script: PathBuf,
|
||||||
|
init_msg: Vec<u8>,
|
||||||
},
|
},
|
||||||
CloseWindow {
|
CloseWindow {
|
||||||
id: usize,
|
id: usize,
|
||||||
|
@ -194,11 +195,12 @@ impl WindowStore {
|
||||||
id,
|
id,
|
||||||
protocol,
|
protocol,
|
||||||
script,
|
script,
|
||||||
|
init_msg,
|
||||||
} => {
|
} => {
|
||||||
println!("Opening window {} with script {:?}", id, script);
|
println!("Opening window {} with script {:?}", id, script);
|
||||||
let module = std::fs::read(script)?;
|
let module = std::fs::read(script)?;
|
||||||
let mut script = self.runtime.load_module(&module)?;
|
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 = Window::new(self.ipc_sender.to_owned(), id, panel, &event_loop)?;
|
||||||
let window_id = window.get_id();
|
let window_id = window.get_id();
|
||||||
self.windows.insert(window_id, window);
|
self.windows.insert(window_id, window);
|
||||||
|
|
Loading…
Reference in New Issue