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

@ -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

2
iced

@ -1 +1 @@
Subproject commit 56b6d6571ca4292a3c2293ec05d537e12da972e5
Subproject commit 8195c7f50de6f07ea7475861f9be5139d3fa61e3

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()
}

View file

@ -499,10 +499,10 @@ pub trait ApplicationExt: Application {
fn minimize(&mut self) -> iced::Command<Message<Self::Message>>;
/// 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<Message<Self::Message>>;
#[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<App: Application> 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<App: Application> 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<Message<Self::Message>> {
self.core_mut()
.title