refactor!: remove cosmic::iced_* re-exports

This commit is contained in:
Adam Cosner 2026-04-08 01:12:10 +00:00 committed by GitHub
parent d9121d6f0d
commit 5d1dfc4c54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 77 additions and 100 deletions

View file

@ -1,8 +1,8 @@
use cosmic::app::{Core, Task}; use cosmic::app::{Core, Task};
use cosmic::iced::core::window;
use cosmic::iced::window::Id; use cosmic::iced::window::Id;
use cosmic::iced::{Length, Rectangle}; use cosmic::iced::{Length, Rectangle};
use cosmic::iced_runtime::core::window;
use cosmic::surface::action::{app_popup, destroy_popup}; use cosmic::surface::action::{app_popup, destroy_popup};
use cosmic::widget::{dropdown::popup_dropdown, list_column, settings, toggler}; use cosmic::widget::{dropdown::popup_dropdown, list_column, settings, toggler};
use cosmic::Element; use cosmic::Element;
@ -159,7 +159,7 @@ impl cosmic::Application for Window {
"oops".into() "oops".into()
} }
fn style(&self) -> Option<cosmic::iced_core::theme::Style> { fn style(&self) -> Option<cosmic::iced::theme::Style> {
Some(cosmic::applet::style()) Some(cosmic::applet::style())
} }
} }

View file

@ -4,7 +4,7 @@
//! Application API example //! Application API example
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::iced_core::Size; use cosmic::iced::Size;
use cosmic::widget::menu; use cosmic::widget::menu;
use cosmic::{executor, iced, ApplicationExt, Element}; use cosmic::{executor, iced, ApplicationExt, Element};
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -7,10 +7,10 @@ use std::collections::HashMap;
use std::{env, process}; use std::{env, process};
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::iced::alignment::{Horizontal, Vertical};
use cosmic::iced::keyboard::Key;
use cosmic::iced::window; use cosmic::iced::window;
use cosmic::iced_core::alignment::{Horizontal, Vertical}; use cosmic::iced::{Length, Size};
use cosmic::iced_core::keyboard::Key;
use cosmic::iced_core::{Length, Size};
use cosmic::widget::menu::action::MenuAction; use cosmic::widget::menu::action::MenuAction;
use cosmic::widget::menu::key_bind::KeyBind; use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::menu::key_bind::Modifier; use cosmic::widget::menu::key_bind::Modifier;

View file

@ -2,9 +2,9 @@ use std::collections::HashMap;
use cosmic::{ use cosmic::{
app::Core, app::Core,
iced::core::{id, Alignment, Length, Point},
iced::widget::{column, container, scrollable, text},
iced::{self, event, window, Subscription}, iced::{self, event, window, Subscription},
iced_core::{id, Alignment, Length, Point},
iced_widget::{column, container, scrollable, text},
prelude::*, prelude::*,
widget::{button, header_bar}, widget::{button, header_bar},
}; };

View file

@ -6,7 +6,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::iced_core::Size; use cosmic::iced::Size;
use cosmic::widget::{menu, nav_bar}; use cosmic::widget::{menu, nav_bar};
use cosmic::{executor, iced, ApplicationExt, Element}; use cosmic::{executor, iced, ApplicationExt, Element};

View file

@ -6,7 +6,7 @@
use apply::Apply; use apply::Apply;
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::dialog::file_chooser::{self, FileFilter}; use cosmic::dialog::file_chooser::{self, FileFilter};
use cosmic::iced_core::Length; use cosmic::iced::Length;
use cosmic::widget::button; use cosmic::widget::button;
use cosmic::{executor, iced, ApplicationExt, Element}; use cosmic::{executor, iced, ApplicationExt, Element};
use std::sync::Arc; use std::sync::Arc;

View file

@ -7,7 +7,7 @@ use std::collections::HashMap;
use chrono::Datelike; use chrono::Datelike;
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::iced_core::Size; use cosmic::iced::Size;
use cosmic::prelude::*; use cosmic::prelude::*;
use cosmic::widget::table; use cosmic::widget::table;
use cosmic::widget::{self, nav_bar}; use cosmic::widget::{self, nav_bar};

View file

@ -6,13 +6,6 @@ use crate::{
Application, Element, Renderer, Application, Element, Renderer,
app::iced_settings, app::iced_settings,
cctk::sctk, cctk::sctk,
iced::{
self, Color, Length, Limits, Rectangle,
alignment::{Alignment, Horizontal, Vertical},
widget::Container,
window,
},
iced_widget,
theme::{self, Button, THEME, system_dark, system_light}, theme::{self, Button, THEME, system_dark, system_light},
widget::{ widget::{
self, self,
@ -24,8 +17,15 @@ use crate::{
space::vertical, space::vertical,
}, },
}; };
pub use cosmic_panel_config; pub use cosmic_panel_config;
use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize}; use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize};
use iced::{
self, Color, Length, Limits, Rectangle,
alignment::{Alignment, Horizontal, Vertical},
widget::Container,
window,
};
use iced_core::{Padding, Shadow}; use iced_core::{Padding, Shadow};
use iced_runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner}; use iced_runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
use iced_widget::Text; use iced_widget::Text;
@ -226,7 +226,7 @@ impl Context {
let symbolic = icon.symbolic; let symbolic = icon.symbolic;
let icon = widget::icon(icon) let icon = widget::icon(icon)
.class(if symbolic { .class(if symbolic {
theme::Svg::Custom(Rc::new(|theme| crate::iced_widget::svg::Style { theme::Svg::Custom(Rc::new(|theme| iced_widget::svg::Style {
color: Some(theme.cosmic().background.on.into()), color: Some(theme.cosmic().background.on.into()),
})) }))
} else { } else {

View file

@ -1,11 +1,11 @@
use crate::iced; use crate::iced;
use crate::iced_futures::futures;
use cctk::sctk::reexports::calloop; use cctk::sctk::reexports::calloop;
use futures::{ use futures::{
SinkExt, StreamExt, SinkExt, StreamExt,
channel::mpsc::{UnboundedReceiver, unbounded}, channel::mpsc::{UnboundedReceiver, unbounded},
}; };
use iced::Subscription; use iced::Subscription;
use iced_futures::futures;
use iced_futures::stream; use iced_futures::stream;
use std::{fmt::Debug, hash::Hash, thread::JoinHandle}; use std::{fmt::Debug, hash::Hash, thread::JoinHandle};

View file

@ -66,29 +66,6 @@ pub mod font;
#[doc(inline)] #[doc(inline)]
pub use iced; pub use iced;
#[doc(inline)]
pub use iced_core;
#[doc(inline)]
pub use iced_futures;
#[doc(inline)]
pub use iced_renderer;
#[doc(inline)]
pub use iced_runtime;
#[doc(inline)]
pub use iced_widget;
#[doc(inline)]
#[cfg(feature = "winit")]
pub use iced_winit;
#[doc(inline)]
#[cfg(feature = "wgpu")]
pub use iced_wgpu;
pub mod icon_theme; pub mod icon_theme;
pub mod keyboard_nav; pub mod keyboard_nav;

View file

@ -4,10 +4,10 @@
//! A widget that displays an interactive calendar. //! A widget that displays an interactive calendar.
use crate::fl; use crate::fl;
use crate::iced_core::{Alignment, Length};
use crate::widget::{button, column, grid, icon, row, text}; use crate::widget::{button, column, grid, icon, row, text};
use apply::Apply; use apply::Apply;
use iced::alignment::Vertical; use iced::alignment::Vertical;
use iced_core::{Alignment, Length};
use jiff::{ use jiff::{
ToSpan, ToSpan,
civil::{Date, Weekday}, civil::{Date, Weekday},

View file

@ -1,13 +1,8 @@
//! An expandable stack of cards //! An expandable stack of cards
use std::time::Duration; use std::time::Duration;
use self::iced_core::{
Element, Event, Length, Size, Vector, Widget, border::Radius, id::Id, layout::Node,
renderer::Quad, widget::Tree,
};
use crate::{ use crate::{
anim, anim,
iced_core::{self, Border, Shadow},
widget::{ widget::{
button, button,
card::style::Style, card::style::Style,
@ -18,6 +13,10 @@ use crate::{
}; };
use float_cmp::approx_eq; use float_cmp::approx_eq;
use iced::widget; use iced::widget;
use iced_core::{
Border, Element, Event, Length, Shadow, Size, Vector, Widget, border::Radius, id::Id,
layout::Node, renderer::Quad, widget::Tree,
};
use iced_core::{widget::tree, window}; use iced_core::{widget::tree, window};
const ICON_SIZE: u16 = 16; const ICON_SIZE: u16 = 16;

View file

@ -7,23 +7,24 @@ use iced::Vector;
use crate::{ use crate::{
Element, Element,
iced::{
Event, Length, Rectangle,
clipboard::{
dnd::{self, DndAction, DndDestinationRectangle, DndEvent, OfferEvent},
mime::AllowedMimeTypes,
},
event,
id::Internal,
mouse, overlay,
},
iced_core::{
self, Clipboard, Shell, layout,
widget::{Tree, tree},
},
widget::{Id, Widget}, widget::{Id, Widget},
}; };
use iced::{
Event, Length, Rectangle,
clipboard::{
dnd::{self, DndAction, DndDestinationRectangle, DndEvent, OfferEvent},
mime::AllowedMimeTypes,
},
event,
id::Internal,
mouse, overlay,
};
use iced_core::{
self, Clipboard, Shell, layout,
widget::{Tree, tree},
};
pub fn dnd_destination<'a, Message: 'static>( pub fn dnd_destination<'a, Message: 'static>(
child: impl Into<Element<'a, Message>>, child: impl Into<Element<'a, Message>>,
mimes: Vec<Cow<'static, str>>, mimes: Vec<Cow<'static, str>>,

View file

@ -4,17 +4,17 @@ use iced_core::{widget::Operation, window};
use crate::{ use crate::{
Element, Element,
iced::{
Event, Length, Point, Rectangle, Vector,
clipboard::dnd::{DndAction, DndEvent, SourceEvent},
event, mouse, overlay,
},
iced_core::{
self, Clipboard, Shell, layout, renderer,
widget::{Tree, tree},
},
widget::{Id, Widget, container}, widget::{Id, Widget, container},
}; };
use iced::{
Event, Length, Point, Rectangle, Vector,
clipboard::dnd::{DndAction, DndEvent, SourceEvent},
event, mouse, overlay,
};
use iced_core::{
self, Clipboard, Shell, layout, renderer,
widget::{Tree, tree},
};
pub fn dnd_source< pub fn dnd_source<
'a, 'a,

View file

@ -9,11 +9,11 @@ use std::rc::Rc;
use iced::advanced::widget::text::Style as TextStyle; use iced::advanced::widget::text::Style as TextStyle;
use iced_widget::core::{Element, renderer}; use iced_widget::core::{Element, renderer};
use crate::iced_core::{Alignment, Length};
use crate::widget::menu::action::MenuAction; use crate::widget::menu::action::MenuAction;
use crate::widget::menu::key_bind::KeyBind; use crate::widget::menu::key_bind::KeyBind;
use crate::widget::{Button, RcElementWrapper, icon}; use crate::widget::{Button, RcElementWrapper, icon};
use crate::{theme, widget}; use crate::{theme, widget};
use iced_core::{Alignment, Length};
/// Nested menu is essentially a tree of items, a menu is a collection of items /// Nested menu is essentially a tree of items, a menu is a collection of items
/// a menu itself can also be an item of another menu. /// a menu itself can also be an item of another menu.

View file

@ -3,7 +3,6 @@
use super::model::{Entity, Model, Selectable}; use super::model::{Entity, Model, Selectable};
use super::{InsertPosition, ReorderEvent}; use super::{InsertPosition, ReorderEvent};
use crate::iced_core::id::Internal;
use crate::theme::{SegmentedButton as Style, THEME}; use crate::theme::{SegmentedButton as Style, THEME};
use crate::widget::dnd_destination::DragId; use crate::widget::dnd_destination::DragId;
use crate::widget::menu::{ use crate::widget::menu::{
@ -22,6 +21,7 @@ use iced::{
Alignment, Background, Color, Event, Length, Padding, Rectangle, Size, Task, Vector, alignment, Alignment, Background, Color, Event, Length, Padding, Rectangle, Size, Task, Vector, alignment,
keyboard, mouse, touch, window, keyboard, mouse, touch, window,
}; };
use iced_core::id::Internal;
use iced_core::mouse::ScrollDelta; use iced_core::mouse::ScrollDelta;
use iced_core::text::{self, Ellipsize, LineHeight, Renderer as TextRenderer, Shaping, Wrapping}; use iced_core::text::{self, Ellipsize, LineHeight, Renderer as TextRenderer, Shaping, Wrapping};
use iced_core::widget::operation::Focusable; use iced_core::widget::operation::Focusable;
@ -2043,10 +2043,10 @@ where
..image_bounds ..image_bounds
}, },
crate::widget::icon(match crate::widget::common::object_select().data() { crate::widget::icon(match crate::widget::common::object_select().data() {
crate::iced_core::svg::Data::Bytes(bytes) => { iced_core::svg::Data::Bytes(bytes) => {
crate::widget::icon::from_svg_bytes(bytes.as_ref()).symbolic(true) crate::widget::icon::from_svg_bytes(bytes.as_ref()).symbolic(true)
} }
crate::iced_core::svg::Data::Path(path) => { iced_core::svg::Data::Path(path) => {
crate::widget::icon::from_path(path.clone()) crate::widget::icon::from_path(path.clone())
} }
}), }),

View file

@ -2,18 +2,18 @@
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use crate::{Element, anim, iced_core::Border, iced_widget::toggler::Status}; use crate::{Element, anim};
use iced_core::{ use iced_core::{
Clipboard, Event, Layout, Length, Pixels, Rectangle, Shell, Size, Widget, alignment, event, Border, Clipboard, Event, Layout, Length, Pixels, Rectangle, Shell, Size, Widget, alignment,
layout, mouse, event, layout, mouse,
renderer::{self, Renderer}, renderer::{self, Renderer},
text, touch, text, touch,
widget::{self, Tree, tree}, widget::{self, Tree, tree},
window, window,
}; };
use iced_widget::Id; use iced_widget::{Id, toggler::Status};
pub use crate::iced_widget::toggler::{Catalog, Style}; pub use iced_widget::toggler::{Catalog, Style};
pub fn toggler<'a, Message>(is_checked: bool) -> Toggler<'a, Message> { pub fn toggler<'a, Message>(is_checked: bool) -> Toggler<'a, Message> {
Toggler::new(is_checked) Toggler::new(is_checked)
@ -200,7 +200,7 @@ impl<'a, Message> Widget<Message, crate::Theme, crate::Renderer> for Toggler<'a,
align_x: self.text_alignment, align_x: self.text_alignment,
align_y: alignment::Vertical::Top, align_y: alignment::Vertical::Top,
shaping: self.text_shaping, shaping: self.text_shaping,
wrapping: crate::iced_core::text::Wrapping::default(), wrapping: iced_core::text::Wrapping::default(),
ellipsize: self.ellipsize, ellipsize: self.ellipsize,
}, },
); );

View file

@ -93,8 +93,8 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
&mut self, &mut self,
tree: &mut tree::Tree, tree: &mut tree::Tree,
renderer: &crate::Renderer, renderer: &crate::Renderer,
limits: &crate::iced_core::layout::Limits, limits: &iced_core::layout::Limits,
) -> crate::iced_core::layout::Node { ) -> iced_core::layout::Node {
self.element self.element
.with_data_mut(|e| e.as_widget_mut().layout(tree, renderer, limits)) .with_data_mut(|e| e.as_widget_mut().layout(tree, renderer, limits))
} }
@ -104,9 +104,9 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
tree: &tree::Tree, tree: &tree::Tree,
renderer: &mut crate::Renderer, renderer: &mut crate::Renderer,
theme: &crate::Theme, theme: &crate::Theme,
style: &crate::iced_core::renderer::Style, style: &iced_core::renderer::Style,
layout: crate::iced_core::Layout<'_>, layout: iced_core::Layout<'_>,
cursor: crate::iced_core::mouse::Cursor, cursor: iced_core::mouse::Cursor,
viewport: &Rectangle, viewport: &Rectangle,
) { ) {
self.element.with_data(move |e| { self.element.with_data(move |e| {
@ -134,7 +134,7 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
fn operate( fn operate(
&mut self, &mut self,
state: &mut tree::Tree, state: &mut tree::Tree,
layout: crate::iced_core::Layout<'_>, layout: iced_core::Layout<'_>,
renderer: &crate::Renderer, renderer: &crate::Renderer,
operation: &mut dyn widget::Operation, operation: &mut dyn widget::Operation,
) { ) {
@ -148,11 +148,11 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
&mut self, &mut self,
state: &mut tree::Tree, state: &mut tree::Tree,
event: &crate::iced::Event, event: &crate::iced::Event,
layout: crate::iced_core::Layout<'_>, layout: iced_core::Layout<'_>,
cursor: crate::iced_core::mouse::Cursor, cursor: iced_core::mouse::Cursor,
renderer: &crate::Renderer, renderer: &crate::Renderer,
clipboard: &mut dyn crate::iced_core::Clipboard, clipboard: &mut dyn iced_core::Clipboard,
shell: &mut crate::iced_core::Shell<'_, M>, shell: &mut iced_core::Shell<'_, M>,
viewport: &Rectangle, viewport: &Rectangle,
) { ) {
self.element.with_data_mut(|e| { self.element.with_data_mut(|e| {
@ -165,11 +165,11 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
fn mouse_interaction( fn mouse_interaction(
&self, &self,
state: &tree::Tree, state: &tree::Tree,
layout: crate::iced_core::Layout<'_>, layout: iced_core::Layout<'_>,
cursor: crate::iced_core::mouse::Cursor, cursor: iced_core::mouse::Cursor,
viewport: &Rectangle, viewport: &Rectangle,
renderer: &crate::Renderer, renderer: &crate::Renderer,
) -> crate::iced_core::mouse::Interaction { ) -> iced_core::mouse::Interaction {
self.element.with_data(|e| { self.element.with_data(|e| {
e.as_widget() e.as_widget()
.mouse_interaction(state, layout, cursor, viewport, renderer) .mouse_interaction(state, layout, cursor, viewport, renderer)
@ -179,11 +179,11 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
fn overlay<'a>( fn overlay<'a>(
&'a mut self, &'a mut self,
state: &'a mut tree::Tree, state: &'a mut tree::Tree,
layout: crate::iced_core::Layout<'a>, layout: iced_core::Layout<'a>,
renderer: &crate::Renderer, renderer: &crate::Renderer,
viewport: &Rectangle, viewport: &Rectangle,
translation: crate::iced_core::Vector, translation: iced_core::Vector,
) -> Option<crate::iced_core::overlay::Element<'a, M, crate::Theme, crate::Renderer>> { ) -> Option<iced_core::overlay::Element<'a, M, crate::Theme, crate::Renderer>> {
assert_eq!(self.element.thread_id, thread::current().id()); assert_eq!(self.element.thread_id, thread::current().id());
Rc::get_mut(&mut self.element.data).and_then(|e| { Rc::get_mut(&mut self.element.data).and_then(|e| {
e.get_mut() e.get_mut()
@ -203,9 +203,9 @@ impl<M> Widget<M, crate::Theme, crate::Renderer> for RcElementWrapper<M> {
fn drag_destinations( fn drag_destinations(
&self, &self,
state: &tree::Tree, state: &tree::Tree,
layout: crate::iced_core::Layout<'_>, layout: iced_core::Layout<'_>,
renderer: &crate::Renderer, renderer: &crate::Renderer,
dnd_rectangles: &mut crate::iced_core::clipboard::DndDestinationRectangles, dnd_rectangles: &mut iced_core::clipboard::DndDestinationRectangles,
) { ) {
self.element.with_data_mut(|e| { self.element.with_data_mut(|e| {
e.as_widget_mut() e.as_widget_mut()