summaryrefslogtreecommitdiffstats
path: root/futures/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-01-17 08:12:44 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-17 08:12:44 +0100
commit0001a6d63642b299531ff089f961732a1bfa2339 (patch)
tree7b100257baf72dbceccf5c3343abf3a6b9f1db03 /futures/src
parentc4ba657de86d7606587dad5124f435141258f570 (diff)
parent985acb2b1532b3e56161bd35201c4a2e21a86b85 (diff)
downloadiced-0001a6d63642b299531ff089f961732a1bfa2339.tar.gz
iced-0001a6d63642b299531ff089f961732a1bfa2339.tar.bz2
iced-0001a6d63642b299531ff089f961732a1bfa2339.zip
Merge pull request #2169 from iced-rs/update-winit
Update `winit` to `0.29`
Diffstat (limited to 'futures/src')
-rw-r--r--futures/src/keyboard.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/futures/src/keyboard.rs b/futures/src/keyboard.rs
index af68e1f2..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,11 +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,
}
})
@@ -38,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,
@@ -50,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,
}
})