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)]
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;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
pub use tooltip::Tooltip;

View file

@ -50,7 +50,7 @@ pub fn popup_dropdown<
let dropdown: Dropdown<'_, S, Message, AppMessage> =
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);
dropdown

View file

@ -60,7 +60,7 @@ where
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + 'static + Send + Sync>>,
#[setters(strip_option)]
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,
}
@ -96,14 +96,14 @@ where
text_line_height: text::LineHeight::Relative(1.2),
font: 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(),
on_surface_action: 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.
/// Intended to be used with [`crate::app::message::get_popup`]
pub fn with_popup<NewAppMessage>(
@ -154,7 +154,7 @@ where
self
}
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
pub fn with_positioner(
mut self,
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
@ -268,7 +268,7 @@ where
layout,
cursor,
shell,
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
self.positioner.clone(),
self.on_selected.clone(),
self.selected,
@ -346,7 +346,7 @@ where
viewport: &Rectangle,
translation: Vector,
) -> 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() {
return None;
}
@ -545,7 +545,7 @@ pub fn update<
layout: Layout<'_>,
cursor: mouse::Cursor,
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,
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>,
selected: Option<usize>,
@ -571,7 +571,7 @@ pub fn update<
*hovered_guard = selected;
let id = window::Id::unique();
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
.as_ref()
.zip(_window_id)
@ -658,7 +658,7 @@ pub fn update<
state.close_operation = false;
state.is_open.store(false, Ordering::SeqCst);
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 {
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
// bounds or on the drop-down, either way we close the overlay.
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 {
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`].
#[allow(clippy::too_many_arguments)]
pub fn menu_widget<

View file

@ -308,7 +308,7 @@ pub use toggler::{Toggler, toggler};
#[doc(inline)]
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 tooltip {

View file

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