Ignore captured key presses in global handler

This commit is contained in:
Jeremy Soller 2024-02-28 15:25:25 -07:00
parent 24ccc9bd82
commit bb1c57bbf5
No known key found for this signature in database
GPG key ID: D02FD439211AF56F

View file

@ -1338,10 +1338,11 @@ impl Application for App {
struct WatcherSubscription;
let mut subscriptions = vec![
event::listen_with(|event, _status| match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => {
Some(Message::Key(modifiers, key))
}
event::listen_with(|event, status| match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status {
event::Status::Ignored => Some(Message::Key(modifiers, key)),
event::Status::Captured => None,
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}