summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-13 12:53:06 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-13 12:53:06 +0200
commita108b2eebe210c774d07e436be5d73293dfea9eb (patch)
tree6adfe63a00c1a8757060a25888cdd3f8070a8ece /runtime
parent1eabd3821928f47451363f7bca3757701182a4c1 (diff)
downloadiced-a108b2eebe210c774d07e436be5d73293dfea9eb.tar.gz
iced-a108b2eebe210c774d07e436be5d73293dfea9eb.tar.bz2
iced-a108b2eebe210c774d07e436be5d73293dfea9eb.zip
Add `resize_events` subscription to `window` module
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/window.rs11
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| {