yoda-v2: color_picker Theme ref + context_menu/menu ungate winit

Two perf + correctness wins packaged as +yoda-v2 (version bump 0.1.0-yoda
-> 0.1.0-yoda.2):

1. color_picker::draw() — use the theme: &Theme parameter already passed
   to draw() instead of THEME.lock().unwrap().clone() which cloned the
   whole Theme on every redraw (src/widget/color_picker/mod.rs:622).
   Upstreamable.

2. Dropped feature = "winit" from 21 combined cfg attrs in context_menu.rs,
   menu/menu_bar.rs, menu/menu_inner.rs. These triple-gates (wayland +
   winit + surface-message) were silently disabling all context-menu and
   menubar popup creation in yoda apps (which don't activate the winit
   feature). Now the code only gates on wayland + surface-message, which
   is our actual runtime path. Matches the ungate we already did on
   surface/action.rs in Phase 3d.

cargo check --lib passes. All 4 consumer apps rebuilt + installed as
+yoda-v2 (backup of previous yoda binaries in .pre-yoda-v2 siblings).
This commit is contained in:
Lionel DARNIS 2026-04-23 18:43:52 +02:00
parent aec3eb615f
commit 8ab7b15807
5 changed files with 6 additions and 23 deletions

View file

@ -5,7 +5,7 @@
# that used to ask for `libcosmic` are replaced by deps on our forks that ask # that used to ask for `libcosmic` are replaced by deps on our forks that ask
# for `libcosmic-yoda`. # for `libcosmic-yoda`.
name = "libcosmic-yoda" name = "libcosmic-yoda"
version = "0.1.0-yoda" version = "0.1.0-yoda.2"
edition = "2024" edition = "2024"
rust-version = "1.90" rust-version = "1.90"

View file

@ -619,8 +619,10 @@ where
let bounds = canvas_layout.bounds(); let bounds = canvas_layout.bounds();
// Draw the handle on the saturation value canvas // Draw the handle on the saturation value canvas
let t = THEME.lock().unwrap().clone(); // Yoda: use the Theme passed into draw() instead of locking the global
let t = t.cosmic(); // 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 handle_radius = f32::from(t.space_xs()) / 2.0;
let (x, y) = ( let (x, y) = (
self.active_color self.active_color

View file

@ -6,7 +6,6 @@
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem}; use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
@ -67,7 +66,6 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
@ -377,7 +375,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
@ -421,7 +418,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) { if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -443,7 +439,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
@ -482,7 +477,6 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))

View file

@ -13,7 +13,6 @@ use super::{
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem}; use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
@ -199,7 +198,6 @@ pub struct MenuBar<Message> {
#[cfg(all( #[cfg(all(
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
feature = "winit",
target_os = "linux" target_os = "linux"
))] ))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner, positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner,
@ -239,7 +237,6 @@ where
#[cfg(all( #[cfg(all(
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
feature = "winit",
target_os = "linux" target_os = "linux"
))] ))]
positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(), positioner: iced_runtime::platform_specific::wayland::popup::SctkPositioner::default(),
@ -338,7 +335,6 @@ where
#[cfg(all( #[cfg(all(
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
feature = "winit",
target_os = "linux" target_os = "linux"
))] ))]
pub fn with_positioner( pub fn with_positioner(
@ -376,7 +372,6 @@ where
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
@ -647,7 +642,6 @@ where
#[cfg(all( #[cfg(all(
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
{ {
@ -671,7 +665,6 @@ where
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) { if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -686,7 +679,6 @@ where
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) { if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
@ -769,7 +761,6 @@ where
feature = "multi-window", feature = "multi-window",
feature = "wayland", feature = "wayland",
target_os = "linux", target_os = "linux",
feature = "winit",
feature = "surface-message" feature = "surface-message"
))] ))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))

View file

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