Unify keyboard subscriptions into listen
This commit is contained in:
parent
0df5765e2f
commit
7e5b6f6802
9 changed files with 77 additions and 96 deletions
|
|
@ -117,7 +117,12 @@ impl Example {
|
|||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
keyboard::on_key_press(|key, _physical_key, modifiers| {
|
||||
keyboard::listen().filter_map(|event| {
|
||||
let keyboard::Event::KeyPressed { key, modifiers, .. } = event
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
|
||||
if !modifiers.command() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue