Remove a dead input enum variant

This commit is contained in:
Brooks J Rady 2021-03-25 14:13:59 +00:00
parent 23df8e447a
commit 81a517b264
2 changed files with 17 additions and 18 deletions

View file

@ -593,25 +593,25 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
} }
// FIXME: Deduplicate this with the callback below! // FIXME: Deduplicate this with the callback below!
PluginInstruction::Input(input_type, input_bytes) => { PluginInstruction::Input(input_type, input_bytes) => {
if let PluginInputType::Event(event) = input_type { let PluginInputType::Event(event) = input_type;
for (instance, plugin_env) in plugin_map.values() { for (instance, plugin_env) in plugin_map.values() {
if !plugin_env.events.contains(&event) { if !plugin_env.events.contains(&event) {
continue; continue;
} }
let handle_key = instance let handle_key = instance
.exports .exports
.get_function(handler_map.get(&event).unwrap()) .get_function(handler_map.get(&event).unwrap())
.unwrap(); .unwrap();
for key in input_bytes.keys().flatten() { for key in input_bytes.keys().flatten() {
let key = cast_termion_key(key); let key = cast_termion_key(key);
wasi_write_string( wasi_write_string(
&plugin_env.wasi_env, &plugin_env.wasi_env,
&serde_json::to_string(&key).unwrap(), &serde_json::to_string(&key).unwrap(),
); );
handle_key.call(&[]).unwrap(); handle_key.call(&[]).unwrap();
}
} }
} }
drop(send_screen_instructions.send(ScreenInstruction::Render)); drop(send_screen_instructions.send(ScreenInstruction::Render));
} }
PluginInstruction::Unload(pid) => drop(plugin_map.remove(&pid)), PluginInstruction::Unload(pid) => drop(plugin_map.remove(&pid)),

View file

@ -23,7 +23,6 @@ pub enum NaughtyEventType {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum PluginInputType { pub enum PluginInputType {
Normal(u32),
Event(NaughtyEventType), Event(NaughtyEventType),
} }