From 493bf6c47a46e735bbb91a2ee06629839bfca911 Mon Sep 17 00:00:00 2001 From: Ashley Wulber <48420062+wash2@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:59:13 -0500 Subject: [PATCH] fix: avoid accidentally triggering vendoring of iced_winit when not used (#238) --- Cargo.toml | 3 +-- iced | 2 +- src/app/cosmic.rs | 18 +++++++++--------- src/app/mod.rs | 16 ++++++++-------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 83948625..777c9e4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,10 +30,9 @@ wayland = [ "iced/wayland", "iced_sctk", "cctk", - "multi-window", ] # multi-window support -multi-window = ["iced_runtime/multi-window", "iced/multi-window", "iced_winit?/multi-window"] +multi-window = ["iced/multi-window"] # Render with wgpu wgpu = ["iced/wgpu", "iced_wgpu"] # X11 window support via winit diff --git a/iced b/iced index 56b6d657..8195c7f5 160000 --- a/iced +++ b/iced @@ -1 +1 @@ -Subproject commit 56b6d6571ca4292a3c2293ec05d537e12da972e5 +Subproject commit 8195c7f50de6f07ea7475861f9be5139d3fa61e3 diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index 065b3fcf..24c00035 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -17,7 +17,7 @@ use iced::multi_window::Application as IcedApplication; #[cfg(feature = "wayland")] use iced::wayland::Application as IcedApplication; use iced::window; -#[cfg(not(feature = "multi-window"))] +#[cfg(not(any(feature = "multi-window", feature = "wayland")))] use iced::Application as IcedApplication; use iced_futures::event::listen_raw; #[cfg(not(feature = "wayland"))] @@ -88,12 +88,12 @@ where (Self::new(model), command) } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn title(&self) -> String { self.app.title().to_string() } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn title(&self, id: window::Id) -> String { self.app.title(id).to_string() } @@ -108,12 +108,12 @@ where } } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn scale_factor(&self) -> f64 { f64::from(self.app.core().scale_factor()) } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn scale_factor(&self, _id: window::Id) -> f64 { f64::from(self.app.core().scale_factor()) } @@ -197,17 +197,17 @@ where ]) } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn theme(&self) -> Self::Theme { crate::theme::active() } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn theme(&self, _id: window::Id) -> Self::Theme { crate::theme::active() } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn view(&self, id: window::Id) -> Element { if id != window::Id::MAIN { return self.app.view_window(id).map(super::Message::App); @@ -220,7 +220,7 @@ where } } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn view(&self) -> Element { self.app.view_main() } diff --git a/src/app/mod.rs b/src/app/mod.rs index 17d37dbf..651f0469 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -499,10 +499,10 @@ pub trait ApplicationExt: Application { fn minimize(&mut self) -> iced::Command>; /// Get the title of the main window. - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn title(&self) -> &str; - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] /// Get the title of a window. fn title(&self, id: window::Id) -> &str; @@ -516,11 +516,11 @@ pub trait ApplicationExt: Application { self.core_mut().set_header_title(title); } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] /// Set the title of the main window. fn set_window_title(&mut self, title: String) -> iced::Command>; - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] /// Set the title of a window. fn set_window_title( &mut self, @@ -545,17 +545,17 @@ impl ApplicationExt for App { command::minimize(Some(window::Id::MAIN)) } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn title(&self, id: window::Id) -> &str { self.core().title.get(&id).map(|s| s.as_str()).unwrap_or("") } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn title(&self) -> &str { &self.core().window.header_title } - #[cfg(feature = "multi-window")] + #[cfg(any(feature = "multi-window", feature = "wayland"))] fn set_window_title( &mut self, title: String, @@ -565,7 +565,7 @@ impl ApplicationExt for App { command::set_title(Some(id), title) } - #[cfg(not(feature = "multi-window"))] + #[cfg(not(any(feature = "multi-window", feature = "wayland")))] fn set_window_title(&mut self, title: String) -> iced::Command> { self.core_mut() .title