fix: avoid accidentally triggering vendoring of iced_winit when not used (#238)

This commit is contained in:
Ashley Wulber 2023-12-11 12:59:13 -05:00 committed by GitHub
parent 74ee508427
commit 493bf6c47a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 20 deletions

View file

@ -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<Self::Message> {
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::Message> {
self.app.view_main()
}