From 9e3ad0e1e025232f93ef04bc79328c3444839a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 10 Nov 2022 01:27:35 +0100 Subject: [PATCH] Use crates.io release for `winit` --- Cargo.toml | 2 +- core/src/event.rs | 21 ---------- examples/url_handler/Cargo.toml | 9 ---- examples/url_handler/src/main.rs | 70 -------------------------------- src/lib.rs | 2 +- winit/src/application.rs | 11 ----- winit/src/multi_window.rs | 16 -------- 7 files changed, 2 insertions(+), 129 deletions(-) delete mode 100644 examples/url_handler/Cargo.toml delete mode 100644 examples/url_handler/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index ef7eae6130..cddf7d9073 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,4 +161,4 @@ web-time = "0.2" wgpu = "0.19" winapi = "0.3" window_clipboard = "0.4.1" -winit = { git = "https://github.com/iced-rs/winit.git", rev = "b91e39ece2c0d378c3b80da7f3ab50e17bb798a5" } +winit = "0.29" diff --git a/core/src/event.rs b/core/src/event.rs index 870b3074e4..e7acbb50ad 100644 --- a/core/src/event.rs +++ b/core/src/event.rs @@ -23,27 +23,6 @@ pub enum Event { /// A touch event Touch(touch::Event), - - /// 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), } /// The status of an [`Event`] after being processed. diff --git a/examples/url_handler/Cargo.toml b/examples/url_handler/Cargo.toml deleted file mode 100644 index 7bb9914b36..0000000000 --- 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 = "2021" -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 bf57012319..0000000000 --- a/examples/url_handler/src/main.rs +++ /dev/null @@ -1,70 +0,0 @@ -use iced::event::{self, Event}; -use iced::executor; -use iced::widget::{container, text}; -use iced::{ - Application, Command, Element, Length, Settings, Subscription, Theme, -}; - -pub fn main() -> iced::Result { - App::run(Settings::default()) -} - -#[derive(Debug, Default)] -struct App { - url: Option, -} - -#[derive(Debug, Clone)] -enum Message { - EventOccurred(Event), -} - -impl Application for App { - type Message = Message; - type Theme = Theme; - type Executor = executor::Default; - type Flags = (); - - fn new(_flags: ()) -> (App, Command) { - (App::default(), Command::none()) - } - - fn title(&self) -> String { - String::from("Url - Iced") - } - - fn update(&mut self, message: Message) -> Command { - match message { - Message::EventOccurred(event) => { - if let Event::PlatformSpecific( - event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl( - url, - )), - ) = event - { - self.url = Some(url); - } - } - }; - - Command::none() - } - - fn subscription(&self) -> Subscription { - event::listen().map(Message::EventOccurred) - } - - fn view(&self) -> Element { - let content = match &self.url { - Some(url) => text(url), - None => text("No URL received yet!"), - }; - - container(content.size(48)) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() - .into() - } -} diff --git a/src/lib.rs b/src/lib.rs index 236c64d3dd..8b811ca73e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -230,7 +230,7 @@ pub mod font { pub mod event { //! Handle events of a user interface. - pub use crate::core::event::{Event, MacOS, PlatformSpecific, Status}; + pub use crate::core::event::{Event, Status}; pub use iced_futures::event::{listen, listen_raw, listen_with}; } diff --git a/winit/src/application.rs b/winit/src/application.rs index 0c596b3f6e..9314a43701 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -349,17 +349,6 @@ async fn run_instance( window.request_redraw(); redraw_pending = true; } - event::Event::PlatformSpecific(event::PlatformSpecific::MacOS( - event::MacOS::ReceivedUrl(url), - )) => { - use crate::core::event; - - events.push(Event::PlatformSpecific( - event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl( - url, - )), - )); - } event::Event::UserEvent(message) => { messages.push(message); } diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index c63dd43332..b52e0fd817 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -459,22 +459,6 @@ async fn run_instance( window.raw.request_redraw(); } } - event::Event::PlatformSpecific( - event::PlatformSpecific::MacOS( - event::MacOS::ReceivedUrl(url), - ), - ) => { - use crate::core::event; - - events.push(( - None, - event::Event::PlatformSpecific( - event::PlatformSpecific::MacOS( - event::MacOS::ReceivedUrl(url), - ), - ), - )); - } event::Event::UserEvent(message) => { messages.push(message); }