Introduce keyboard::on_key_press and on_key_release

Also rename `subscription::events*` to `event::listen*`.
This commit is contained in:
Héctor Ramón Jiménez 2023-09-07 02:45:15 +02:00
parent a56b25b909
commit 08a031cbe5
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
14 changed files with 193 additions and 138 deletions

View file

@ -10,7 +10,8 @@ use crate::command::{self, Command};
use crate::core::time::Instant;
use crate::core::window::{Event, Icon, Level, Mode, UserAttention};
use crate::core::Size;
use crate::futures::subscription::{self, Subscription};
use crate::futures::event;
use crate::futures::Subscription;
/// Subscribes to the frames of the window of the running application.
///
@ -21,7 +22,7 @@ use crate::futures::subscription::{self, Subscription};
/// In any case, this [`Subscription`] is useful to smoothly draw application-driven
/// animations without missing any frames.
pub fn frames() -> Subscription<Instant> {
subscription::raw_events(|event, _status| match event {
event::listen_raw(|event, _status| match event {
iced_core::Event::Window(Event::RedrawRequested(at)) => Some(at),
_ => None,
})