yoda: fork pivot — Wayland-only + ungate winit + soft-fork libcosmic-yoda (squashed)

Squash of 7 yoda commits forming the fork pivot:
- 255cf7cc rename: libcosmic -> libcosmic-yoda (fork 0.1.0-yoda)
- 8701aa31 feat(yoda): Wayland-only cut — drop winit and x11 features
- 6736a596 yoda: soft-fork pivot — keep Cargo name 'libcosmic' for dep unification
- 3e23d087 yoda: re-apply hard rename — libcosmic -> libcosmic-yoda (0.1.0-yoda)
- aec3eb61 yoda: ungate remaining winit+wayland combined cfgs
- 8ab7b158 yoda-v2: color_picker Theme ref + context_menu/menu ungate winit
- 8d1d8739 yoda: drop x11 defaults on iced_winit + iced_tiny_skia
This commit is contained in:
Lionel DARNIS 2026-05-25 13:02:07 +02:00
parent 10422b8f4a
commit e3dcdf1fce
101 changed files with 77 additions and 98 deletions

View file

@ -1,7 +1,6 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
#[cfg(feature = "winit")]
use crate::app;
#[cfg(feature = "single-instance")]
use crate::dbus_activation;
@ -9,7 +8,6 @@ use crate::dbus_activation;
pub const fn app<M>(message: M) -> Action<M> {
Action::App(message)
}
#[cfg(feature = "winit")]
pub const fn cosmic<M>(message: app::Action) -> Action<M> {
Action::Cosmic(message)
}
@ -23,7 +21,6 @@ pub const fn none<M>() -> Action<M> {
pub enum Action<M> {
/// Messages from the application, for the application.
App(M),
#[cfg(feature = "winit")]
/// Internal messages to be handled by libcosmic.
Cosmic(app::Action),
#[cfg(feature = "single-instance")]

View file

@ -27,12 +27,10 @@ pub fn set_title<M>(id: window::Id, title: String) -> iced::Task<crate::Action<M
iced::Task::none()
}
#[cfg(feature = "winit")]
pub fn set_scaling_factor<M: Send + 'static>(factor: f32) -> iced::Task<crate::Action<M>> {
iced::Task::done(crate::app::Action::ScaleFactor(factor)).map(crate::Action::Cosmic)
}
#[cfg(feature = "winit")]
pub fn set_theme<M: Send + 'static>(theme: crate::Theme) -> iced::Task<crate::Action<M>> {
iced::Task::done(crate::app::Action::AppThemeChange(theme)).map(crate::Action::Cosmic)
}

View file

@ -432,7 +432,6 @@ impl Core {
id
}
#[cfg(feature = "winit")]
pub fn drag<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else {
return iced::Task::none();
@ -440,7 +439,6 @@ impl Core {
crate::command::drag(id)
}
#[cfg(feature = "winit")]
pub fn maximize<M: Send + 'static>(
&self,
id: Option<window::Id>,
@ -452,7 +450,6 @@ impl Core {
crate::command::maximize(id, maximized)
}
#[cfg(feature = "winit")]
pub fn minimize<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else {
return iced::Task::none();
@ -460,7 +457,6 @@ impl Core {
crate::command::minimize(id)
}
#[cfg(feature = "winit")]
pub fn set_title<M: Send + 'static>(
&self,
id: Option<window::Id>,
@ -472,7 +468,6 @@ impl Core {
crate::command::set_title(id, title)
}
#[cfg(feature = "winit")]
pub fn set_windowed<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else {
return iced::Task::none();
@ -480,7 +475,6 @@ impl Core {
crate::command::set_windowed(id)
}
#[cfg(feature = "winit")]
pub fn toggle_maximize<M: Send + 'static>(
&self,
id: Option<window::Id>,

View file

@ -7,7 +7,6 @@
/// Recommended default imports.
pub mod prelude {
#[cfg(feature = "winit")]
pub use crate::ApplicationExt;
pub use crate::ext::*;
pub use crate::{Also, Apply, Element, Renderer, Task, Theme};
@ -21,9 +20,7 @@ pub use action::Action;
pub mod anim;
#[cfg(feature = "winit")]
pub mod app;
#[cfg(feature = "winit")]
#[doc(inline)]
pub use app::{Application, ApplicationExt};

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
use super::Action;
#[cfg(feature = "winit")]
use crate::Application;
use iced::window;
@ -28,7 +27,7 @@ pub fn destroy_window(id: iced_core::window::Id) -> Action {
Action::DestroyWindow(id)
}
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn app_window<App: Application>(
settings: impl Fn(&mut App) -> window::Settings + Send + Sync + 'static,
@ -61,7 +60,7 @@ pub fn app_window<App: Application>(
}
/// Used to create a window message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn simple_window<Message: 'static>(
settings: impl Fn() -> window::Settings + Send + Sync + 'static,
@ -93,7 +92,7 @@ pub fn simple_window<Message: 'static>(
)
}
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn app_popup<App: Application>(
settings: impl Fn(&mut App) -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
@ -127,7 +126,7 @@ pub fn app_popup<App: Application>(
}
/// Used to create a subsurface message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn simple_subsurface<Message: 'static, V>(
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
@ -156,7 +155,7 @@ pub fn simple_subsurface<Message: 'static, V>(
}
/// Used to create a popup message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn simple_popup<Message: 'static>(
settings: impl Fn() -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
@ -187,7 +186,7 @@ pub fn simple_popup<Message: 'static>(
)
}
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn subsurface<App: Application>(
settings: impl Fn(

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

@ -619,8 +619,10 @@ where
let bounds = canvas_layout.bounds();
// Draw the handle on the saturation value canvas
let t = THEME.lock().unwrap().clone();
let t = t.cosmic();
// Yoda: use the Theme passed into draw() instead of locking the global
// THEME Mutex and cloning the whole Theme. Fires on every color-picker
// redraw, so saving the Mutex lock + full Theme clone adds up.
let t = theme.cosmic();
let handle_radius = f32::from(t.space_xs()) / 2.0;
let (x, y) = (
self.active_color

View file

@ -6,7 +6,6 @@
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
@ -67,7 +66,6 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
#[allow(clippy::too_many_lines)]
@ -378,7 +376,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
@ -422,7 +419,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -444,7 +440,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
@ -483,7 +478,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))

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

@ -13,7 +13,6 @@ use crate::Renderer;
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
@ -194,7 +193,6 @@ pub struct MenuBar<Message> {
#[cfg(all(
feature = "multi-window",
feature = "wayland",
feature = "winit",
target_os = "linux"
))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
@ -234,7 +232,6 @@ where
#[cfg(all(
feature = "multi-window",
feature = "wayland",
feature = "winit",
target_os = "linux"
))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
@ -333,7 +330,6 @@ where
#[cfg(all(
feature = "multi-window",
feature = "wayland",
feature = "winit",
target_os = "linux"
))]
pub fn with_positioner(
@ -371,7 +367,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
#[allow(clippy::too_many_lines)]
@ -643,7 +638,6 @@ where
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
{
@ -667,7 +661,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -682,7 +675,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -765,7 +757,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))

View file

@ -10,7 +10,6 @@ use super::menu_tree::MenuTree;
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
@ -680,7 +679,6 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
@ -965,7 +963,6 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
#[cfg(all(
feature = "multi-window",
feature = "wayland",
feature = "winit",
feature = "surface-message",
target_os = "linux"
))]
@ -1228,7 +1225,6 @@ pub(crate) fn init_root_menu<Message: Clone>(
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
pub(super) fn init_root_popup_menu<Message>(
@ -1525,7 +1521,7 @@ where
.as_ref()
.is_some_and(|i| *i != new_index && !active_menu[*i].children.is_empty());
#[cfg(all(feature = "multi-window", feature = "wayland",target_os = "linux", feature = "winit", feature = "surface-message"))]
#[cfg(all(feature = "multi-window", feature = "wayland", target_os = "linux", feature = "surface-message"))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove {
if let Some(id) = state.popup_id.remove(&menu.window_id) {
state.active_root.truncate(menu.depth + 1);

View file

@ -312,7 +312,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

@ -23,7 +23,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)
@ -32,7 +32,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)
}