3 Commits

View File

@@ -109,11 +109,15 @@ impl Main {
}
fn exchange_recv(&mut self) {
loop {
match self.c.try_recv() {
Ok(msg) => self.ntfy2 = msg,
_ => {},
Ok(msg) => {
self.ntfy2 = msg
},
_ => return,
};
}
}
fn exchange_send(&mut self) {
let mut s = vec![];
@@ -253,7 +257,7 @@ impl Application for Main {
self.configuring = None;
},
_ => {},
}
};
},
Message::EventOccurred(event) => {
match event {
@@ -269,6 +273,7 @@ impl Application for Main {
self.keys_newly_down.dedup();
},
};
self.exchange();
},
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
key_code,
@@ -288,9 +293,10 @@ impl Application for Main {
},
None => {},
};
self.exchange();
},
_ => {},
}
};
},
_ => {
self.configuring = Some(msg.clone());
@@ -306,7 +312,7 @@ impl Application for Main {
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
_ => None,
}),
every(std::time::Duration::from_millis(5)).map(|_| Message::Tick),
every(std::time::Duration::from_millis(5000)).map(|_| Message::Tick),
]);
}
@@ -341,7 +347,9 @@ impl Feedback {
loop {
std::thread::sleep(std::time::Duration::from_secs(2));
match self.read() {
Some(msg) if msg.len() > 0 => self.write(msg),
Some(msg) if msg.len() > 0 => {
self.write(msg.clone());
},
_ => {},
};
}