Skip to content

Commit

Permalink
Fix double escape to close a window
Browse files Browse the repository at this point in the history
  • Loading branch information
Exidex committed Feb 22, 2024
1 parent 81c12fc commit ac0dea8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rust/client/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ impl Application for AppModel {
struct RequestLoop;
struct GlobalShortcutListener;

let events_subscription = event::listen_with(|event, status| match status {
event::Status::Ignored => Some(AppMsg::IcedEvent(event)),
event::Status::Captured => match event {
Event::Keyboard(keyboard::Event::KeyPressed { key: Key::Named(Named::Escape), .. }) => Some(AppMsg::IcedEvent(event)),
_ => None
}
});

Subscription::batch([
subscription::channel(
std::any::TypeId::of::<GlobalShortcutListener>(),
Expand All @@ -405,7 +413,7 @@ impl Application for AppModel {
unreachable!()
},
),
event::listen().map(AppMsg::IcedEvent),
events_subscription,
subscription::channel(
std::any::TypeId::of::<RequestLoop>(),
100,
Expand Down

0 comments on commit ac0dea8

Please sign in to comment.