From 82db3c78b6cfa2cc55ece6ffa46811bfb5195f60 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 20 Jul 2021 21:34:20 +0700 Subject: Update `winit` and `glutin` dependencies ... and remove crates.io patch --- Cargo.toml | 3 --- glutin/Cargo.toml | 4 ++-- winit/Cargo.toml | 4 ++-- winit/src/conversion.rs | 17 +++++------------ 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1a4da1e3..5b1cfb0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,9 +93,6 @@ iced_core = { version = "0.4", path = "core" } iced_futures = { version = "0.3", path = "futures" } thiserror = "1.0" -[patch.crates-io] -winit = { git = "https://github.com/iced-rs/winit", rev = "327c8756f90953a6a03f818113f8566176e6eb0d"} - [target.'cfg(not(target_arch = "wasm32"))'.dependencies] iced_winit = { version = "0.3", path = "winit" } iced_glutin = { version = "0.2", path = "glutin", optional = true } diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index b42a6b36..b2a7f307 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -15,8 +15,8 @@ debug = ["iced_winit/debug"] [dependencies.glutin] version = "0.27" -# git = "https://github.com/iced-rs/glutin" -# rev = "2564d0ab87cf2ad824a2a58733aebe40dd2f29bb" +git = "https://github.com/iced-rs/glutin" +rev = "03437d8a1826d83c62017b2bb7bf18bfc9e352cc" [dependencies.iced_native] version = "0.4" diff --git a/winit/Cargo.toml b/winit/Cargo.toml index 87fd23d5..b1192135 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -20,8 +20,8 @@ thiserror = "1.0" [dependencies.winit] version = "0.25" -# git = "https://github.com/iced-rs/winit" -# rev = "e351421a32bf01b428325dde44dea39ee2656153" +git = "https://github.com/iced-rs/winit" +rev = "844485272a7412cb35cdbfac3524decdf59475ca" [dependencies.iced_native] version = "0.4" diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index e61611aa..5a8b9fd8 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -218,17 +218,15 @@ pub fn menu(menu: &Menu) -> winit::window::Menu { /// Given a [`Menu`] and an identifier of a [`menu::Entry`], it returns the /// `Message` that should be produced when that entry is activated. -pub fn menu_message(menu: &Menu, id: isize) -> Option +pub fn menu_message(menu: &Menu, id: u32) -> Option where Message: Clone, { - use std::convert::TryFrom; - fn find_message( - target: usize, - starting_id: usize, + target: u32, + starting_id: u32, menu: &Menu, - ) -> Result + ) -> Result where Message: Clone, { @@ -260,12 +258,7 @@ where Err(id - starting_id) } - // TODO: Does `winit` really need to provide an `isize`? - if let Ok(id) = usize::try_from(id) { - find_message(id, 0, menu).ok() - } else { - None - } + find_message(id, 0, menu).ok() } /// Converts a `MouseCursor` from [`iced_native`] to a [`winit`] cursor icon. -- cgit