yoda: ungate remaining winit+wayland combined cfgs

During Phase 3d it surfaced that several widgets keep a three-clause
cfg `#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]`
(e.g. dropdown::widget::with_popup, widget/mod.rs menu bits,
theme/style/mod.rs). Since the yoda fork is wayland-only the "winit"
clause is vestigial — dropping it unhides these methods for Wayland
consumers (cosmic-settings needs Dropdown::with_popup on the wallpaper
page).

Also fixed a cfg asymmetry in responsive_menu_bar.rs: the fallback
block was gated `cfg(not(all(winit, wayland, linux)))` while the
primary block was `cfg(all(wayland, linux))`. With winit removed both
blocks were active and we got E0308 expected-() — aligned the cfgs so
exactly one branch compiles.
This commit is contained in:
Lionel DARNIS 2026-04-23 17:36:21 +02:00
parent 3e23d08728
commit aec3eb615f
5 changed files with 17 additions and 17 deletions

View file

@ -32,7 +32,7 @@ mod text_input;
#[doc(inline)] #[doc(inline)]
pub use self::text_input::TextInput; pub use self::text_input::TextInput;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
pub mod tooltip; pub mod tooltip;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
pub use tooltip::Tooltip; pub use tooltip::Tooltip;

View file

@ -50,7 +50,7 @@ pub fn popup_dropdown<
let dropdown: Dropdown<'_, S, Message, AppMessage> = let dropdown: Dropdown<'_, S, Message, AppMessage> =
Dropdown::new(selections.into(), selected, on_selected); Dropdown::new(selections.into(), selected, on_selected);
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
let dropdown = dropdown.with_popup(_parent_id, _on_surface_action, _map_action); let dropdown = dropdown.with_popup(_parent_id, _on_surface_action, _map_action);
dropdown dropdown

View file

@ -60,7 +60,7 @@ where
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>, action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>,
#[setters(strip_option)] #[setters(strip_option)]
window_id: Option<window::Id>, window_id: Option<window::Id>,
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner, positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
} }
@ -96,14 +96,14 @@ where
text_line_height: text::LineHeight::Relative(1.2), text_line_height: text::LineHeight::Relative(1.2),
font: None, font: None,
window_id: None, window_id: None,
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(), positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
on_surface_action: None, on_surface_action: None,
action_map: None, action_map: None,
} }
} }
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
/// Handle dropdown requests for popup creation. /// Handle dropdown requests for popup creation.
/// Intended to be used with [`crate::app::message::get_popup`] /// Intended to be used with [`crate::app::message::get_popup`]
pub fn with_popup<NewAppMessage>( pub fn with_popup<NewAppMessage>(
@ -154,7 +154,7 @@ where
self self
} }
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
pub fn with_positioner( pub fn with_positioner(
mut self, mut self,
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner, positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
@ -268,7 +268,7 @@ where
layout, layout,
cursor, cursor,
shell, shell,
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
self.positioner.clone(), self.positioner.clone(),
self.on_selected.clone(), self.on_selected.clone(),
self.selected, self.selected,
@ -346,7 +346,7 @@ where
viewport: &Rectangle, viewport: &Rectangle,
translation: Vector, translation: Vector,
) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> { ) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
if self.window_id.is_some() || self.on_surface_action.is_some() { if self.window_id.is_some() || self.on_surface_action.is_some() {
return None; return None;
} }
@ -545,7 +545,7 @@ pub fn update<
layout: Layout<'_>, layout: Layout<'_>,
cursor: mouse::Cursor, cursor: mouse::Cursor,
shell: &mut Shell<'_, Message>, shell: &mut Shell<'_, Message>,
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner, positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>, on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>,
selected: Option<usize>, selected: Option<usize>,
@ -571,7 +571,7 @@ pub fn update<
*hovered_guard = selected; *hovered_guard = selected;
let id = window::Id::unique(); let id = window::Id::unique();
state.popup_id = id; state.popup_id = id;
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
if let Some(((on_surface_action, parent), action_map)) = on_surface_action if let Some(((on_surface_action, parent), action_map)) = on_surface_action
.as_ref() .as_ref()
.zip(_window_id) .zip(_window_id)
@ -658,7 +658,7 @@ pub fn update<
state.close_operation = false; state.close_operation = false;
state.is_open.store(false, Ordering::SeqCst); state.is_open.store(false, Ordering::SeqCst);
if is_open { if is_open {
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
if let Some(ref on_close) = on_surface_action { if let Some(ref on_close) = on_surface_action {
shell.publish(on_close(surface::action::destroy_popup(state.popup_id))); shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
} }
@ -681,7 +681,7 @@ pub fn update<
// Event wasn't processed by overlay, so cursor was clicked either outside it's // Event wasn't processed by overlay, so cursor was clicked either outside it's
// bounds or on the drop-down, either way we close the overlay. // bounds or on the drop-down, either way we close the overlay.
state.is_open.store(false, Ordering::Relaxed); state.is_open.store(false, Ordering::Relaxed);
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
if let Some(on_close) = on_surface_action { if let Some(on_close) = on_surface_action {
shell.publish(on_close(surface::action::destroy_popup(state.popup_id))); shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));
} }
@ -726,7 +726,7 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor) -> mouse::In
} }
} }
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
/// Returns the current menu widget of a [`Dropdown`]. /// Returns the current menu widget of a [`Dropdown`].
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn menu_widget< pub fn menu_widget<

View file

@ -308,7 +308,7 @@ pub use toggler::{Toggler, toggler};
#[doc(inline)] #[doc(inline)]
pub use tooltip::{Tooltip, tooltip}; pub use tooltip::{Tooltip, tooltip};
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
pub mod wayland; pub mod wayland;
pub mod tooltip { pub mod tooltip {

View file

@ -25,7 +25,7 @@ impl Default for ResponsiveMenuBar {
fn default() -> ResponsiveMenuBar { fn default() -> ResponsiveMenuBar {
ResponsiveMenuBar { ResponsiveMenuBar {
collapsed_item_width: { collapsed_item_width: {
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
if matches!( if matches!(
crate::app::cosmic::WINDOWING_SYSTEM.get(), crate::app::cosmic::WINDOWING_SYSTEM.get(),
Some(crate::app::cosmic::WindowingSystem::Wayland) Some(crate::app::cosmic::WindowingSystem::Wayland)
@ -34,7 +34,7 @@ impl Default for ResponsiveMenuBar {
} else { } else {
ItemWidth::Static(84) ItemWidth::Static(84)
} }
#[cfg(not(all(feature = "winit", feature = "wayland", target_os = "linux")))] #[cfg(not(all(feature = "wayland", target_os = "linux")))]
{ {
ItemWidth::Static(84) ItemWidth::Static(84)
} }