diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/src/window.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 815827d1..ee03f84f 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -194,6 +194,17 @@ pub fn close_events() -> Subscription<Id> { }) } +/// Subscribes to all [`Event::Resized`] occurrences in the running application. +pub fn resize_events() -> Subscription<(Id, Size)> { + event::listen_with(|event, _status, id| { + if let crate::core::Event::Window(Event::Resized(size)) = event { + Some((id, size)) + } else { + None + } + }) +} + /// Subscribes to all [`Event::CloseRequested`] occurences in the running application. pub fn close_requests() -> Subscription<Id> { event::listen_with(|event, _status, id| { |