commit
This commit is contained in:
parent
bc1ced79a8
commit
19a595c21b
26 changed files with 754 additions and 559 deletions
|
@ -48,8 +48,14 @@ pub fn run<
|
|||
description: e.to_string(),
|
||||
})?;
|
||||
|
||||
let should_stop = matches!(event, HandlerEvent::Stop);
|
||||
|
||||
h.handle(event);
|
||||
handler = Either::Left(h);
|
||||
|
||||
if should_stop {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Either::Right(init_handler) => {
|
||||
let initial_message = serde_json::from_str::<InitialHandlerMessage<KeyConfig, KnobConfig>>(&line);
|
||||
|
|
|
@ -42,6 +42,7 @@ pub enum KeyEvent {
|
|||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "kebab-case")]
|
||||
pub enum HandlerEvent {
|
||||
Stop,
|
||||
Knob { path: KnobPath, event: KnobEvent },
|
||||
Key { path: KeyPath, event: KeyEvent },
|
||||
}
|
||||
|
|
|
@ -374,7 +374,7 @@ impl PaThread {
|
|||
let current_state = Arc::clone(&self.current_state);
|
||||
let mainloop = Rc::clone(&self.mainloop);
|
||||
|
||||
loop {
|
||||
'outer: loop {
|
||||
self.run_single_mainloop_iteration(false);
|
||||
|
||||
while let Ok(command) = self.commands_rx.try_recv() {
|
||||
|
@ -403,11 +403,13 @@ impl PaThread {
|
|||
}
|
||||
}
|
||||
PaCommand::Terminate => {
|
||||
mainloop.borrow_mut().quit(Retval(0));
|
||||
break 'outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainloop.borrow_mut().quit(Retval(0));
|
||||
}
|
||||
|
||||
fn unwrap_state(state: &Arc<RwLock<Option<Arc<PaVolumeState>>>>) -> Arc<PaVolumeState> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue