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 261a211647
commit 45eaaf1605
101 changed files with 82 additions and 103 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

@ -461,7 +461,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();
@ -469,7 +468,6 @@ impl Core {
crate::command::drag(id)
}
#[cfg(feature = "winit")]
pub fn maximize<M: Send + 'static>(
&self,
id: Option<window::Id>,
@ -481,7 +479,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();
@ -489,7 +486,6 @@ impl Core {
crate::command::minimize(id)
}
#[cfg(feature = "winit")]
pub fn set_title<M: Send + 'static>(
&self,
id: Option<window::Id>,
@ -501,7 +497,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();
@ -509,7 +504,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

@ -90,7 +90,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};
@ -104,9 +103,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,13 +2,12 @@
// SPDX-License-Identifier: MPL-2.0
use super::Action;
#[cfg(feature = "winit")]
use crate::Application;
use iced::{Rectangle, window};
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
use iced_runtime::platform_specific::wayland::CornerRadius;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
use iced_runtime::platform_specific::wayland::layer_surface::IcedMargin;
use std::any::Any;
use std::sync::Arc;
@ -40,17 +39,17 @@ pub fn destroy_layer_shell(id: iced_core::window::Id) -> Action {
#[derive(Debug, Default, Copy, Clone)]
pub struct LiveSettings {
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
/// Override the surface padding value for the surface type.
pub padding: Option<IcedMargin>,
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
/// Override the default corner radius value for the surface type.
pub corners: Option<CornerRadius>,
/// Override the default blur setting for the surface type.
pub blur: Option<bool>,
}
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
type BoxedView<App> = Option<
Box<
dyn Fn(&App) -> crate::Element<'_, crate::Action<<App as Application>::Message>>
@ -60,7 +59,7 @@ type BoxedView<App> = Option<
>,
>;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
#[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use]
pub fn app_window<App: Application>(
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
@ -92,7 +91,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>(
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
@ -129,7 +128,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>(
live_settings: impl Fn(&App) -> LiveSettings + Send + Sync + 'static,
@ -162,7 +161,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>(
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
@ -192,7 +191,7 @@ pub fn simple_subsurface<Message: 'static>(
}
/// 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>(
live_settings: impl Fn() -> LiveSettings + Send + Sync + 'static,
@ -228,7 +227,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

@ -597,8 +597,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)]
@ -394,7 +392,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))
@ -438,7 +435,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)) {
@ -460,7 +456,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))
@ -499,7 +494,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)
@ -661,7 +661,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)));
}
@ -684,7 +684,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)));
}
@ -729,7 +729,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)]
@ -660,7 +655,6 @@ where
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
{
@ -684,7 +678,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -699,7 +692,6 @@ where
feature = "multi-window",
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -796,7 +788,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};
@ -681,7 +680,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))
@ -993,7 +991,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"
))]
@ -1275,7 +1272,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>(
@ -1572,7 +1568,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)
}