diff --git a/Cargo.lock b/Cargo.lock index 730314bd..db381e82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1349,8 +1349,9 @@ dependencies = [ [[package]] name = "dpi" -version = "0.1.1" -source = "git+https://github.com/iced-rs/winit.git?rev=05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed#05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "editor" @@ -6336,13 +6337,6 @@ dependencies = [ "serde", ] -[[package]] -name = "url_handler" -version = "0.1.0" -dependencies = [ - "iced", -] - [[package]] name = "urlencoding" version = "2.1.3" @@ -7482,8 +7476,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winit" -version = "0.30.8" -source = "git+https://github.com/iced-rs/winit.git?rev=05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed#05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" +version = "0.30.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732" dependencies = [ "ahash", "android-activity", diff --git a/Cargo.toml b/Cargo.toml index c26f8805..41e18976 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -235,7 +235,7 @@ web-sys = "0.3.69" web-time = "1.1" wgpu = { version = "27.0", default-features = false, features = ["std", "wgsl"] } window_clipboard = { version = "0.5", default-features = false } -winit = { git = "https://github.com/iced-rs/winit.git", rev = "05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed", default-features = false, features = ["rwh_06"] } +winit = { version = "0.30", default-features = false, features = ["rwh_06"] } [workspace.lints.rust] rust_2018_idioms = { level = "deny", priority = -1 } diff --git a/examples/url_handler/Cargo.toml b/examples/url_handler/Cargo.toml deleted file mode 100644 index 1b15d9ab..00000000 --- a/examples/url_handler/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "url_handler" -version = "0.1.0" -authors = ["Héctor Ramón Jiménez "] -edition = "2024" -publish = false - -[dependencies] -iced.workspace = true diff --git a/examples/url_handler/src/main.rs b/examples/url_handler/src/main.rs deleted file mode 100644 index 1bc295c9..00000000 --- a/examples/url_handler/src/main.rs +++ /dev/null @@ -1,42 +0,0 @@ -use iced::event; -use iced::widget::{center, text}; -use iced::{Element, Subscription}; - -pub fn main() -> iced::Result { - iced::application(App::default, App::update, App::view) - .subscription(App::subscription) - .run() -} - -#[derive(Debug, Default)] -struct App { - url: Option, -} - -#[derive(Debug, Clone)] -enum Message { - UrlReceived(String), -} - -impl App { - fn update(&mut self, message: Message) { - match message { - Message::UrlReceived(url) => { - self.url = Some(url); - } - } - } - - fn subscription(&self) -> Subscription { - event::listen_url().map(Message::UrlReceived) - } - - fn view(&self) -> Element<'_, Message> { - let content = match &self.url { - Some(url) => text(url), - None => text("No URL received yet!"), - }; - - center(content.size(48)).into() - } -} diff --git a/futures/src/event.rs b/futures/src/event.rs index 58bc9df2..ec2569de 100644 --- a/futures/src/event.rs +++ b/futures/src/event.rs @@ -37,8 +37,7 @@ where event: Event::Window(window::Event::RedrawRequested(_)), .. } - | subscription::Event::SystemThemeChanged(_) - | subscription::Event::PlatformSpecific(_) => None, + | subscription::Event::SystemThemeChanged(_) => None, subscription::Event::Interaction { window, event, @@ -67,27 +66,6 @@ where event, status, } => f(event, status, window), - subscription::Event::SystemThemeChanged(_) - | subscription::Event::PlatformSpecific(_) => None, - }) -} - -/// Creates a [`Subscription`] that notifies of custom application URL -/// received from the system. -/// -/// _**Note:** Currently, it only triggers on macOS and the executable needs to be properly [bundled]!_ -/// -/// [bundled]: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW19 -pub fn listen_url() -> Subscription { - #[derive(Hash)] - struct ListenUrl; - - subscription::filter_map(ListenUrl, move |event| match event { - subscription::Event::PlatformSpecific( - subscription::PlatformSpecific::MacOS( - subscription::MacOS::ReceivedUrl(url), - ), - ) => Some(url), - _ => None, + subscription::Event::SystemThemeChanged(_) => None, }) } diff --git a/futures/src/subscription.rs b/futures/src/subscription.rs index 548b1aac..01c41010 100644 --- a/futures/src/subscription.rs +++ b/futures/src/subscription.rs @@ -30,27 +30,6 @@ pub enum Event { /// The system theme has changed. SystemThemeChanged(theme::Mode), - - /// A platform specific event. - PlatformSpecific(PlatformSpecific), -} - -/// A platform specific event -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum PlatformSpecific { - /// A MacOS specific event - MacOS(MacOS), -} - -/// Describes an event specific to MacOS -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum MacOS { - /// Triggered when the app receives an URL from the system - /// - /// _**Note:** For this event to be triggered, the executable needs to be properly [bundled]!_ - /// - /// [bundled]: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW19 - ReceivedUrl(String), } /// A stream of runtime events. diff --git a/src/advanced.rs b/src/advanced.rs index e40e3964..af141c43 100644 --- a/src/advanced.rs +++ b/src/advanced.rs @@ -2,8 +2,7 @@ pub mod subscription { //! Write your own subscriptions. pub use crate::runtime::futures::subscription::{ - Event, EventStream, Hasher, MacOS, PlatformSpecific, Recipe, - from_recipe, into_recipes, + Event, EventStream, Hasher, Recipe, from_recipe, into_recipes, }; } diff --git a/src/lib.rs b/src/lib.rs index b70e4333..e4ee6efb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -582,9 +582,7 @@ pub mod font { pub mod event { //! Handle events of a user interface. pub use crate::core::event::{Event, Status}; - pub use iced_futures::event::{ - listen, listen_raw, listen_url, listen_with, - }; + pub use iced_futures::event::{listen, listen_raw, listen_with}; } pub mod keyboard { diff --git a/winit/src/lib.rs b/winit/src/lib.rs index 4b6c649f..05938a77 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -248,23 +248,6 @@ where ); } - fn received_url( - &mut self, - event_loop: &winit::event_loop::ActiveEventLoop, - url: String, - ) { - self.process_event( - event_loop, - Event::EventLoopAwakened( - winit::event::Event::PlatformSpecific( - winit::event::PlatformSpecific::MacOS( - winit::event::MacOS::ReceivedUrl(url), - ), - ), - ), - ); - } - fn about_to_wait( &mut self, event_loop: &winit::event_loop::ActiveEventLoop, @@ -761,19 +744,6 @@ async fn run_instance

( ); } } - event::Event::PlatformSpecific( - event::PlatformSpecific::MacOS( - event::MacOS::ReceivedUrl(url), - ), - ) => { - runtime.broadcast( - subscription::Event::PlatformSpecific( - subscription::PlatformSpecific::MacOS( - subscription::MacOS::ReceivedUrl(url), - ), - ), - ); - } event::Event::UserEvent(action) => { run_action( action,