diff --git a/Cargo.lock b/Cargo.lock index 85fab142e4..cc74c84d0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,6 +175,28 @@ dependencies = [ "libloading", ] +[[package]] +name = "ashpd" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c39d707614dbcc6bed00015539f488d8e3fe3e66ed60961efc0c90f4b380b3" +dependencies = [ + "async-fs 2.1.2", + "async-net 2.0.0", + "enumflags2", + "futures-channel", + "futures-util", + "rand", + "raw-window-handle", + "serde", + "serde_repr", + "url", + "wayland-backend", + "wayland-client", + "wayland-protocols 0.32.5", + "zbus 5.2.0", +] + [[package]] name = "async-broadcast" version = "0.7.1" @@ -331,6 +353,17 @@ dependencies = [ "futures-lite 1.13.0", ] +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io 2.4.0", + "blocking", + "futures-lite 2.5.0", +] + [[package]] name = "async-process" version = "1.8.1" @@ -457,18 +490,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "atk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -644,16 +665,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" -[[package]] -name = "cairo-sys-rs" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" -dependencies = [ - "libc", - "system-deps", -] - [[package]] name = "calloop" version = "0.12.4" @@ -729,16 +740,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -1212,7 +1213,7 @@ dependencies = [ "rust-ini", "web-sys", "winreg", - "zbus", + "zbus 4.4.0", ] [[package]] @@ -1833,36 +1834,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "gdk-pixbuf-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" -dependencies = [ - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "gdk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" -dependencies = [ - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "pkg-config", - "system-deps", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1928,19 +1899,6 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -[[package]] -name = "gio-sys" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", - "winapi", -] - [[package]] name = "gl_generator" version = "0.14.0" @@ -1961,16 +1919,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "glib-sys" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" -dependencies = [ - "libc", - "system-deps", -] - [[package]] name = "gloo-timers" version = "0.3.0" @@ -2016,17 +1964,6 @@ dependencies = [ "wgpu", ] -[[package]] -name = "gobject-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" -dependencies = [ - "glib-sys", - "libc", - "system-deps", -] - [[package]] name = "gpu-alloc" version = "0.6.0" @@ -2086,24 +2023,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "gtk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" -dependencies = [ - "atk-sys", - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gdk-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "system-deps", -] - [[package]] name = "guillotiere" version = "0.6.2" @@ -2198,12 +2117,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hermit-abi" version = "0.3.9" @@ -2473,7 +2386,7 @@ dependencies = [ "log", "lyon_path", "once_cell", - "raw-window-handle 0.6.2", + "raw-window-handle", "rustc-hash 2.1.0", "thiserror 1.0.69", "unicode-segmentation", @@ -2506,7 +2419,7 @@ dependencies = [ "bytes", "iced_core", "iced_futures", - "raw-window-handle 0.6.2", + "raw-window-handle", "thiserror 1.0.69", ] @@ -3334,7 +3247,7 @@ dependencies = [ "log", "ndk-sys 0.6.0+11769913", "num_enum", - "raw-window-handle 0.6.2", + "raw-window-handle", "thiserror 1.0.69", ] @@ -3450,17 +3363,6 @@ dependencies = [ "malloc_buf", ] -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - [[package]] name = "objc-sys" version = "0.3.5" @@ -3664,15 +3566,6 @@ dependencies = [ "objc2-foundation", ] -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - [[package]] name = "object" version = "0.36.5" @@ -3773,7 +3666,7 @@ version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" dependencies = [ - "heck 0.4.1", + "heck", "itertools 0.12.1", "proc-macro2", "proc-macro2-diagnostics", @@ -3827,18 +3720,6 @@ dependencies = [ "iced", ] -[[package]] -name = "pango-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - [[package]] name = "parking" version = "2.2.1" @@ -4112,6 +3993,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + [[package]] name = "powerfmt" version = "0.2.0" @@ -4339,12 +4226,6 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "raw-window-handle" version = "0.6.2" @@ -4516,25 +4397,26 @@ dependencies = [ [[package]] name = "rfd" -version = "0.13.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d8ab342bcc5436e04d3a4c1e09e17d74958bfaddf8d5fad6f85607df0f994f" +checksum = "6a24763657bff09769a8ccf12c8b8a50416fb035fe199263b4c5071e4e3f006f" dependencies = [ - "block", - "dispatch", - "glib-sys", - "gobject-sys", - "gtk-sys", + "ashpd", + "block2", + "core-foundation 0.10.0", + "core-foundation-sys", "js-sys", "log", - "objc", - "objc-foundation", - "objc_id", - "raw-window-handle 0.5.2", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "pollster", + "raw-window-handle", + "urlencoding", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -4803,15 +4685,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -5018,7 +4891,7 @@ dependencies = [ "async-fs 1.6.0", "async-io 1.13.0", "async-lock 2.8.0", - "async-net", + "async-net 1.8.0", "async-process 1.8.1", "blocking", "futures-lite 1.13.0", @@ -5072,7 +4945,7 @@ dependencies = [ "objc2", "objc2-foundation", "objc2-quartz-core", - "raw-window-handle 0.6.2", + "raw-window-handle", "redox_syscall 0.5.8", "rustix 0.38.42", "tiny-xlib", @@ -5261,19 +5134,6 @@ dependencies = [ "windows 0.52.0", ] -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr", - "heck 0.5.0", - "pkg-config", - "toml", - "version-compare", -] - [[package]] name = "system_information" version = "0.1.0" @@ -5282,12 +5142,6 @@ dependencies = [ "iced", ] -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "tempfile" version = "3.14.0" @@ -5570,26 +5424,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] [[package]] name = "toml_edit" @@ -5598,8 +5437,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", - "serde", - "serde_spanned", "toml_datetime", "winnow", ] @@ -5834,6 +5671,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -5843,6 +5681,12 @@ dependencies = [ "iced", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "usvg" version = "0.42.0" @@ -5919,12 +5763,6 @@ dependencies = [ "iced", ] -[[package]] -name = "version-compare" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" - [[package]] name = "version_check" version = "0.9.5" @@ -6315,7 +6153,7 @@ dependencies = [ "naga", "parking_lot 0.12.3", "profiling", - "raw-window-handle 0.6.2", + "raw-window-handle", "smallvec", "static_assertions", "wasm-bindgen", @@ -6343,7 +6181,7 @@ dependencies = [ "once_cell", "parking_lot 0.12.3", "profiling", - "raw-window-handle 0.6.2", + "raw-window-handle", "rustc-hash 1.1.0", "smallvec", "thiserror 1.0.69", @@ -6384,7 +6222,7 @@ dependencies = [ "parking_lot 0.12.3", "profiling", "range-alloc", - "raw-window-handle 0.6.2", + "raw-window-handle", "renderdoc-sys", "rustc-hash 1.1.0", "smallvec", @@ -6448,7 +6286,7 @@ dependencies = [ "clipboard_macos", "clipboard_wayland", "clipboard_x11", - "raw-window-handle 0.6.2", + "raw-window-handle", "thiserror 1.0.69", ] @@ -6789,7 +6627,7 @@ dependencies = [ "orbclient", "percent-encoding", "pin-project", - "raw-window-handle 0.6.2", + "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.42", "sctk-adwaita", @@ -6998,9 +6836,45 @@ dependencies = [ "uds_windows", "windows-sys 0.52.0", "xdg-home", - "zbus_macros", - "zbus_names", - "zvariant", + "zbus_macros 4.4.0", + "zbus_names 3.0.0", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb67eadba43784b6fb14857eba0d8fc518686d3ee537066eb6086dc318e2c8a1" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs 2.1.2", + "async-io 2.4.0", + "async-lock 3.4.0", + "async-process 2.3.0", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener 5.3.1", + "futures-core", + "futures-util", + "hex", + "nix", + "ordered-stream", + "serde", + "serde_repr", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.59.0", + "winnow", + "xdg-home", + "zbus_macros 5.2.0", + "zbus_names 4.1.0", + "zvariant 5.1.0", ] [[package]] @@ -7013,7 +6887,22 @@ dependencies = [ "proc-macro2", "quote", "syn", - "zvariant_utils", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zbus_macros" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d49ebc960ceb660f2abe40a5904da975de6986f2af0d7884b39eec6528c57" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "zbus_names 4.1.0", + "zvariant 5.1.0", + "zvariant_utils 3.0.2", ] [[package]] @@ -7024,7 +6913,19 @@ checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", - "zvariant", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "856b7a38811f71846fd47856ceee8bccaec8399ff53fb370247e66081ace647b" +dependencies = [ + "serde", + "static_assertions", + "winnow", + "zvariant 5.1.0", ] [[package]] @@ -7122,7 +7023,23 @@ dependencies = [ "enumflags2", "serde", "static_assertions", - "zvariant_derive", + "zvariant_derive 4.2.0", +] + +[[package]] +name = "zvariant" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1200ee6ac32f1e5a312e455a949a4794855515d34f9909f4a3e082d14e1a56f" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "url", + "winnow", + "zvariant_derive 5.1.0", + "zvariant_utils 3.0.2", ] [[package]] @@ -7135,7 +7052,20 @@ dependencies = [ "proc-macro2", "quote", "syn", - "zvariant_utils", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zvariant_derive" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687e3b97fae6c9104fbbd36c73d27d149abf04fb874e2efbd84838763daa8916" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "zvariant_utils 3.0.2", ] [[package]] @@ -7148,3 +7078,17 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zvariant_utils" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20d1d011a38f12360e5fcccceeff5e2c42a8eb7f27f0dcba97a0862ede05c9c6" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "static_assertions", + "syn", + "winnow", +] diff --git a/examples/editor/Cargo.toml b/examples/editor/Cargo.toml index dc885728ca..a5a3dd5371 100644 --- a/examples/editor/Cargo.toml +++ b/examples/editor/Cargo.toml @@ -12,4 +12,4 @@ iced.features = ["highlighter", "tokio", "debug"] tokio.workspace = true tokio.features = ["fs"] -rfd = "0.13" +rfd = "0.15.2" diff --git a/examples/editor/src/main.rs b/examples/editor/src/main.rs index d55f9bdfec..2fd711ee57 100644 --- a/examples/editor/src/main.rs +++ b/examples/editor/src/main.rs @@ -35,6 +35,7 @@ enum Message { WordWrapToggled(bool), NewFile, OpenFile, + SelectedFileToOpen(Option), FileOpened(Result<(PathBuf, Arc), Error>), SaveFile, FileSaved(Result), @@ -95,9 +96,28 @@ impl Editor { if self.is_loading { Task::none() } else { + iced::window::get_oldest().and_then(|id| { + iced::window::run_with_window_handles( + id, + move |w| -> Message { + let file = rfd::FileDialog::new() + .set_title("Open a text file...") + .set_parent(&w) + .pick_file(); + + Message::SelectedFileToOpen(file) + }, + ) + }) + } + } + Message::SelectedFileToOpen(file) => { + if let Some(path) = file { self.is_loading = true; - Task::perform(open_file(), Message::FileOpened) + Task::perform(load_file(path), Message::FileOpened) + } else { + Task::none() } } Message::FileOpened(result) => { @@ -237,16 +257,6 @@ pub enum Error { IoError(io::ErrorKind), } -async fn open_file() -> Result<(PathBuf, Arc), Error> { - let picked_file = rfd::AsyncFileDialog::new() - .set_title("Open a text file...") - .pick_file() - .await - .ok_or(Error::DialogClosed)?; - - load_file(picked_file).await -} - async fn load_file( path: impl Into, ) -> Result<(PathBuf, Arc), Error> { diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 0ebdba2f5c..bdcf0af5bd 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -11,7 +11,36 @@ use crate::task::{self, Task}; pub use raw_window_handle; -use raw_window_handle::WindowHandle; +use raw_window_handle::{DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WindowHandle}; + +/// Represents a window with handles for display and window operations. +#[derive(Debug)] +pub struct WindowHandles<'a> { + window_handle: WindowHandle<'a>, + display_handle: DisplayHandle<'a>, +} + +impl HasWindowHandle for WindowHandles<'_> { + fn window_handle(&self) -> Result, HandleError> { + Ok(self.window_handle) + } +} + +impl HasDisplayHandle for WindowHandles<'_> { + fn display_handle(&self) -> Result, HandleError> { + Ok(self.display_handle) + } +} + +impl<'a> WindowHandles<'a> { + /// Creates a new instance of `WindowHandles`. + pub fn new(window_handle: WindowHandle<'a>, display_handle: DisplayHandle<'a>) -> Self { + Self { + window_handle, + display_handle, + } + } +} /// An operation to be performed on some window. #[allow(missing_debug_implementations)] @@ -141,6 +170,9 @@ pub enum Action { /// Runs the closure with the native window handle of the window with the given [`Id`]. RunWithHandle(Id, Box) + Send>), + /// Runs the closure with the native window of the window with the given [`Id`]. + RunWithWindowHandles(Id, Box) + Send>), + /// Screenshot the viewport of the window. Screenshot(Id, oneshot::Sender), @@ -408,6 +440,26 @@ where }) } +/// Runs the given callback with the native window object for the window with the given id. +/// +/// Note that if the window closes before this call is processed the callback will not be run. +pub fn run_with_window_handles( + id: Id, + f: impl FnOnce(WindowHandles<'_>) -> T + Send + 'static, +) -> Task +where + T: Send + 'static, +{ + task::oneshot(move |channel| { + crate::Action::Window(Action::RunWithWindowHandles( + id, + Box::new(move |w| { + let _ = channel.send(f(w)); + }), + )) + }) +} + /// Captures a [`Screenshot`] from the window. pub fn screenshot(id: Id) -> Task { task::oneshot(move |channel| { diff --git a/winit/src/program.rs b/winit/src/program.rs index 26b713f392..2e3c4347e6 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -2,6 +2,7 @@ mod state; mod window_manager; +use iced_runtime::window::WindowHandles; pub use state::State; use crate::conversion; @@ -1422,6 +1423,14 @@ fn run_action( f(handle); } } + window::Action::RunWithWindowHandles(id, f) => { + use winit::raw_window_handle::HasDisplayHandle; + use winit::raw_window_handle::HasWindowHandle; + + if let Some(window) = window_manager.get_mut(id) { + f(WindowHandles::new(window.raw.window_handle().unwrap(), window.raw.display_handle().unwrap())); + } + } window::Action::Screenshot(id, channel) => { if let Some(window) = window_manager.get_mut(id) { let bytes = compositor.screenshot(