readme on install for debian
parent
41962fd914
commit
cc7329f6e4
Binary file not shown.
12
src/gui.rs
12
src/gui.rs
|
|
@ -11,7 +11,7 @@ pub fn main() -> iced::Result {
|
|||
|
||||
struct Main {
|
||||
ntfy: String,
|
||||
configuring: bool,
|
||||
configuring: Option<&char>,
|
||||
inputs: Inputs,
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ impl Application for Main {
|
|||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||
return (Self {
|
||||
ntfy: String::from(":wave:"),
|
||||
configuring: false,
|
||||
configuring: None,
|
||||
inputs: Inputs{
|
||||
stick: Stick {
|
||||
up: 'w',
|
||||
|
|
@ -84,7 +84,7 @@ impl Application for Main {
|
|||
|
||||
fn update(&mut self, msg: Message) -> Command<Message> {
|
||||
match msg {
|
||||
Message::EventOccurred(event) if self.configuring => {
|
||||
Message::EventOccurred(event) if self.configuring.is_some() => {
|
||||
match event {
|
||||
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
|
||||
key_code,
|
||||
|
|
@ -92,14 +92,16 @@ impl Application for Main {
|
|||
..
|
||||
}) => {
|
||||
self.ntfy = format!("would set {:?}", key_code);
|
||||
self.configuring = false;
|
||||
self.configuring = None;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
Message::EventOccurred(event) if ! self.configuring => {},
|
||||
_ => {
|
||||
self.configuring = true;
|
||||
self.configuring = Some(match event {
|
||||
_ => None,
|
||||
});
|
||||
self.ntfy = format!("push a key to bind to {:?}", msg);
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue