Skip to content

Commit

Permalink
Use crates.io release for winit
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Sep 18, 2024
1 parent f897442 commit f67e6ec
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 133 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ web-time = "1.1"
wgpu = "0.19"
winapi = "0.3"
window_clipboard = "0.4.1"
winit = { git = "https://github.com/iced-rs/winit.git", rev = "254d6b3420ce4e674f516f7a2bd440665e05484d" }
winit = "0.30"

[workspace.lints.rust]
rust_2018_idioms = { level = "forbid", priority = -1 }
Expand Down
9 changes: 0 additions & 9 deletions examples/url_handler/Cargo.toml

This file was deleted.

42 changes: 0 additions & 42 deletions examples/url_handler/src/main.rs

This file was deleted.

24 changes: 1 addition & 23 deletions futures/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ where
subscription::Event::Interaction {
event: Event::Window(window::Event::RedrawRequested(_)),
..
}
| subscription::Event::PlatformSpecific(_) => None,
} => None,
subscription::Event::Interaction {
window,
event,
Expand Down Expand Up @@ -66,26 +65,5 @@ where
event,
status,
} => f(event, status, window),
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<String> {
#[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,
})
}
4 changes: 2 additions & 2 deletions futures/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where
status: event::Status::Ignored,
..
} => f(key, modifiers),
_ => None,
subscription::Event::Interaction { .. } => None,
})
}

Expand All @@ -51,6 +51,6 @@ where
status: event::Status::Ignored,
..
} => f(key, modifiers),
_ => None,
subscription::Event::Interaction { .. } => None,
})
}
21 changes: 0 additions & 21 deletions futures/src/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,6 @@ pub enum Event {
/// The [`event::Status`] of the interaction.
status: event::Status,
},

/// 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.
Expand Down
3 changes: 1 addition & 2 deletions src/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
pub mod subscription {
//! Write your own subscriptions.
pub use crate::runtime::futures::subscription::{
from_recipe, into_recipes, Event, EventStream, Hasher, MacOS,
PlatformSpecific, Recipe,
from_recipe, into_recipes, Event, EventStream, Hasher, Recipe,
};
}

Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,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 {
Expand Down
30 changes: 0 additions & 30 deletions winit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,23 +431,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,
Expand Down Expand Up @@ -766,19 +749,6 @@ async fn run_instance<P, C>(
window.raw.request_redraw();
}
}
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,
Expand Down

0 comments on commit f67e6ec

Please sign in to comment.