summaryrefslogtreecommitdiffstats
path: root/futures
diff options
context:
space:
mode:
Diffstat (limited to 'futures')
-rw-r--r--futures/src/keyboard.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/futures/src/keyboard.rs b/futures/src/keyboard.rs
index 855eecd4..8e7da38f 100644
--- a/futures/src/keyboard.rs
+++ b/futures/src/keyboard.rs
@@ -1,6 +1,6 @@
//! Listen to keyboard events.
use crate::core;
-use crate::core::keyboard::{Event, KeyCode, Modifiers};
+use crate::core::keyboard::{Event, Key, Modifiers};
use crate::subscription::{self, Subscription};
use crate::MaybeSend;
@@ -10,7 +10,7 @@ use crate::MaybeSend;
/// If the function returns `None`, the key press will be simply
/// ignored.
pub fn on_key_press<Message>(
- f: fn(KeyCode, Modifiers) -> Option<Message>,
+ f: fn(Key, Modifiers) -> Option<Message>,
) -> Subscription<Message>
where
Message: MaybeSend + 'static,
@@ -22,12 +22,10 @@ where
match (event, status) {
(
core::Event::Keyboard(Event::KeyPressed {
- key_code,
- modifiers,
- ..
+ key, modifiers, ..
}),
core::event::Status::Ignored,
- ) => f(key_code, modifiers),
+ ) => f(key, modifiers),
_ => None,
}
})
@@ -39,7 +37,7 @@ where
/// If the function returns `None`, the key release will be simply
/// ignored.
pub fn on_key_release<Message>(
- f: fn(KeyCode, Modifiers) -> Option<Message>,
+ f: fn(Key, Modifiers) -> Option<Message>,
) -> Subscription<Message>
where
Message: MaybeSend + 'static,
@@ -51,11 +49,12 @@ where
match (event, status) {
(
core::Event::Keyboard(Event::KeyReleased {
- key_code,
+ key,
modifiers,
+ ..
}),
core::event::Status::Ignored,
- ) => f(key_code, modifiers),
+ ) => f(key, modifiers),
_ => None,
}
})