aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Sutherland-Cash <kyle.sutherlandcash@gmail.com>2021-05-01 09:22:21 -0700
committerKyle Sutherland-Cash <kyle.sutherlandcash@gmail.com>2021-05-01 09:22:21 -0700
commit2eadcb86a5377381c41e7fa52395a1dbd75f5a84 (patch)
treeacf6fd67ed72e4b1e104ad879aa7398504587460
parentSimplify some names and start using Bus in the plugin thread (diff)
downloadsl0ppij-2eadcb86a5377381c41e7fa52395a1dbd75f5a84.tar.gz
sl0ppij-2eadcb86a5377381c41e7fa52395a1dbd75f5a84.tar.xz
sl0ppij-2eadcb86a5377381c41e7fa52395a1dbd75f5a84.zip
Bit of renaming
-rw-r--r--src/common/mod.rs16
-rw-r--r--src/common/wasm_vm.rs18
2 files changed, 13 insertions, 21 deletions
diff --git a/src/common/mod.rs b/src/common/mod.rs
index a05b1280..0990172d 100644
--- a/src/common/mod.rs
+++ b/src/common/mod.rs
@@ -550,18 +550,10 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
let plugin_env = PluginEnv {
plugin_id,
- send_pty_instructions: plugin_bus.to_pty.as_ref().unwrap().clone(),
- send_screen_instructions: plugin_bus
- .to_screen
- .as_ref()
- .unwrap()
- .clone(),
- send_app_instructions: plugin_bus.to_app.as_ref().unwrap().clone(),
- send_plugin_instructions: plugin_bus
- .to_plugin
- .as_ref()
- .unwrap()
- .clone(),
+ to_pty: plugin_bus.to_pty.as_ref().unwrap().clone(),
+ to_screen: plugin_bus.to_screen.as_ref().unwrap().clone(),
+ to_app: plugin_bus.to_app.as_ref().unwrap().clone(),
+ to_plugin: plugin_bus.to_plugin.as_ref().unwrap().clone(),
wasi_env,
subscriptions: Arc::new(Mutex::new(HashSet::new())),
};
diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs
index f04d4d5f..253f52f7 100644
--- a/src/common/wasm_vm.rs
+++ b/src/common/wasm_vm.rs
@@ -28,10 +28,10 @@ pub enum PluginInstruction {
pub struct PluginEnv {
pub plugin_id: u32,
// FIXME: This should be a big bundle of all of the channels
- pub send_screen_instructions: SenderWithContext<ScreenInstruction>,
- pub send_app_instructions: SenderWithContext<AppInstruction>,
- pub send_pty_instructions: SenderWithContext<PtyInstruction>,
- pub send_plugin_instructions: SenderWithContext<PluginInstruction>,
+ pub to_screen: SenderWithContext<ScreenInstruction>,
+ pub to_app: SenderWithContext<AppInstruction>,
+ pub to_pty: SenderWithContext<PtyInstruction>,
+ pub to_plugin: SenderWithContext<PluginInstruction>,
pub wasi_env: WasiEnv,
pub subscriptions: Arc<Mutex<HashSet<EventType>>>,
}
@@ -77,7 +77,7 @@ fn host_unsubscribe(plugin_env: &PluginEnv) {
fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) {
let selectable = selectable != 0;
plugin_env
- .send_screen_instructions
+ .to_screen
.send(ScreenInstruction::SetSelectable(
PaneId::Plugin(plugin_env.plugin_id),
selectable,
@@ -88,7 +88,7 @@ fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) {
fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) {
let max_height = max_height as usize;
plugin_env
- .send_screen_instructions
+ .to_screen
.send(ScreenInstruction::SetMaxHeight(
PaneId::Plugin(plugin_env.plugin_id),
max_height,
@@ -99,7 +99,7 @@ fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) {
fn host_set_invisible_borders(plugin_env: &PluginEnv, invisible_borders: i32) {
let invisible_borders = invisible_borders != 0;
plugin_env
- .send_screen_instructions
+ .to_screen
.send(ScreenInstruction::SetInvisibleBorders(
PaneId::Plugin(plugin_env.plugin_id),
invisible_borders,
@@ -118,7 +118,7 @@ fn host_get_plugin_ids(plugin_env: &PluginEnv) {
fn host_open_file(plugin_env: &PluginEnv) {
let path: PathBuf = wasi_read_object(&plugin_env.wasi_env);
plugin_env
- .send_pty_instructions
+ .to_pty
.send(PtyInstruction::SpawnTerminal(Some(path)))
.unwrap();
}
@@ -133,7 +133,7 @@ fn host_set_timeout(plugin_env: &PluginEnv, secs: f64) {
// timers as we'd like.
//
// But that's a lot of code, and this is a few lines:
- let send_plugin_instructions = plugin_env.send_plugin_instructions.clone();
+ let send_plugin_instructions = plugin_env.to_plugin.clone();
let update_target = Some(plugin_env.plugin_id);
thread::spawn(move || {
let start_time = Instant::now();