This commit is contained in:
Ashley Wulber 2025-02-28 12:06:24 -05:00
parent 0ce914b57a
commit 76930d8624
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
58 changed files with 173 additions and 183 deletions

View file

@ -12,11 +12,11 @@ pub struct ContextDrawer<'a, Message: Clone + 'static> {
} }
#[cfg(feature = "about")] #[cfg(feature = "about")]
pub fn about<'a, Message: Clone + 'static>( pub fn about<Message: Clone + 'static>(
about: &'a crate::widget::about::About, about: &crate::widget::about::About,
on_url_press: impl Fn(String) -> Message, on_url_press: impl Fn(String) -> Message,
on_close: Message, on_close: Message,
) -> ContextDrawer<'a, Message> { ) -> ContextDrawer<'_, Message> {
context_drawer(crate::widget::about(about, on_url_press), on_close) context_drawer(crate::widget::about(about, on_url_press), on_close)
} }

View file

@ -1,16 +1,12 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
use std::{cell::OnceCell, collections::HashMap}; use std::collections::HashMap;
use crate::{ use crate::widget::{
surface_message::SurfaceMessage,
theme::menu_bar,
widget::{
button, icon, button, icon,
menu::{self, Tree}, menu::{self},
nav_bar, responsive_container, nav_bar, responsive_container,
},
}; };
use cosmic_config::CosmicConfigEntry; use cosmic_config::CosmicConfigEntry;
use cosmic_theme::ThemeMode; use cosmic_theme::ThemeMode;
@ -21,7 +17,6 @@ use slotmap::Key;
use crate::Theme; use crate::Theme;
use super::{Renderer, Task};
/// Status of the nav bar and its panels. /// Status of the nav bar and its panels.
#[derive(Clone)] #[derive(Clone)]
@ -218,7 +213,7 @@ impl Core {
// Context drawer min width (344px) + padding (8px) // Context drawer min width (344px) + padding (8px)
breakpoint += 344.0 + 8.0; breakpoint += 344.0 + 8.0;
}; };
self.is_condensed = (breakpoint * self.scale_factor) > self.window.width as f32; self.is_condensed = (breakpoint * self.scale_factor) > self.window.width;
self.nav_bar_update(); self.nav_bar_update();
} }
@ -231,7 +226,7 @@ impl Core {
} }
pub(crate) fn context_width(&self, has_nav: bool) -> f32 { pub(crate) fn context_width(&self, has_nav: bool) -> f32 {
let window_width = (self.window.width as f32) / self.scale_factor; let window_width = self.window.width / self.scale_factor;
// Content width (360px) + padding (8px) // Content width (360px) + padding (8px)
let mut reserved_width = 360.0 + 8.0; let mut reserved_width = 360.0 + 8.0;
@ -366,7 +361,7 @@ impl Core {
/// Get the current focused window if it exists /// Get the current focused window if it exists
#[must_use] #[must_use]
pub fn focused_window(&self) -> Option<window::Id> { pub fn focused_window(&self) -> Option<window::Id> {
self.focused_window.clone() self.focused_window
} }
/// Whether the application should use a dark theme, according to the system /// Whether the application should use a dark theme, according to the system
@ -408,9 +403,9 @@ impl Core {
Vec<menu::Item<A, std::borrow::Cow<'static, str>>>, Vec<menu::Item<A, std::borrow::Cow<'static, str>>>,
)>, )>,
) -> crate::Element<'a, Message> { ) -> crate::Element<'a, Message> {
use std::borrow::Cow;
use iced::Length;
use crate::widget::id_container; use crate::widget::id_container;
@ -428,7 +423,7 @@ impl Core {
.map(|mt| { .map(|mt| {
menu::Tree::<_>::with_children( menu::Tree::<_>::with_children(
menu::root(mt.0), menu::root(mt.0),
menu::items(&key_binds, mt.1), menu::items(key_binds, mt.1),
) )
}) })
.collect(), .collect(),
@ -448,7 +443,7 @@ impl Core {
.class(crate::theme::Button::MenuRoot), .class(crate::theme::Button::MenuRoot),
), ),
menu::items( menu::items(
&key_binds, key_binds,
trees trees
.into_iter() .into_iter()
.map(|mt| menu::Item::Folder(mt.0, mt.1)) .map(|mt| menu::Item::Folder(mt.0, mt.1))

View file

@ -6,7 +6,6 @@
//! Check out our [application](https://github.com/pop-os/libcosmic/tree/master/examples/application) //! Check out our [application](https://github.com/pop-os/libcosmic/tree/master/examples/application)
//! example in our repository. //! example in our repository.
use crate::surface_message::{MessageWrapper, SurfaceMessage};
pub mod command; pub mod command;
pub mod context_drawer; pub mod context_drawer;
@ -17,9 +16,9 @@ pub(crate) mod multi_window;
pub mod settings; pub mod settings;
pub mod message { pub mod message {
use crate::surface_message::{MessageWrapper, SurfaceMessage}; use crate::surface_message::SurfaceMessage;
use iced::{Limits, Size};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use] #[must_use]
@ -536,7 +535,7 @@ where
.and_then(|b| b.destination(App::APP_ID).ok()) .and_then(|b| b.destination(App::APP_ID).ok())
.and_then(|b| b.build().ok()) .and_then(|b| b.build().ok())
.is_some_and(|mut p| { .is_some_and(|mut p| {
match { let res = {
let mut platform_data = HashMap::new(); let mut platform_data = HashMap::new();
if let Some(activation_token) = activation_token { if let Some(activation_token) = activation_token {
platform_data.insert("activation-token", activation_token.into()); platform_data.insert("activation-token", activation_token.into());
@ -550,7 +549,7 @@ where
} else { } else {
p.activate(platform_data) p.activate(platform_data)
} }
} { }; match res {
Ok(()) => { Ok(()) => {
tracing::info!("Successfully activated another instance"); tracing::info!("Successfully activated another instance");
true true
@ -1221,6 +1220,6 @@ fn preload_fonts() {
.unwrap(); .unwrap();
EMBEDDED_FONTS EMBEDDED_FONTS
.into_iter() .iter()
.for_each(move |font| font_system.load_font(Cow::Borrowed(font))); .for_each(move |font| font_system.load_font(Cow::Borrowed(font)));
} }

View file

@ -22,8 +22,6 @@ use crate::{
}; };
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 cosmic_theme::Theme;
use iced::Pixels;
use iced_core::{Layout, Padding, Shadow}; use iced_core::{Layout, Padding, Shadow};
use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner}; use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity}; use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
@ -31,7 +29,7 @@ use std::{
borrow::Cow, borrow::Cow,
num::NonZeroU32, num::NonZeroU32,
rc::Rc, rc::Rc,
sync::{Arc, LazyLock}, sync::LazyLock,
}; };
use tracing::info; use tracing::info;
@ -41,7 +39,7 @@ static AUTOSIZE_ID: LazyLock<iced::id::Id> =
static AUTOSIZE_MAIN_ID: LazyLock<iced::id::Id> = static AUTOSIZE_MAIN_ID: LazyLock<iced::id::Id> =
LazyLock::new(|| iced::id::Id::new("cosmic-applet-autosize-main")); LazyLock::new(|| iced::id::Id::new("cosmic-applet-autosize-main"));
static TOOLTIP_ID: LazyLock<crate::widget::Id> = LazyLock::new(|| iced::id::Id::new("subsurface")); static TOOLTIP_ID: LazyLock<crate::widget::Id> = LazyLock::new(|| iced::id::Id::new("subsurface"));
static TOOLTIP_WINDOW_ID: LazyLock<window::Id> = LazyLock::new(|| window::Id::unique()); static TOOLTIP_WINDOW_ID: LazyLock<window::Id> = LazyLock::new(window::Id::unique);
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Context { pub struct Context {
@ -170,8 +168,8 @@ impl Context {
.size(iced_core::Size::new(width, height)) .size(iced_core::Size::new(width, height))
.size_limits( .size_limits(
Limits::NONE Limits::NONE
.min_height(height as f32) .min_height(height)
.min_width(width as f32), .min_width(width),
) )
.resizable(None) .resizable(None)
.default_text_size(14.0) .default_text_size(14.0)
@ -326,7 +324,7 @@ impl Context {
Container::<Message, _, Renderer>::new( Container::<Message, _, Renderer>::new(
Container::<Message, _, Renderer>::new(content).style(|theme| { Container::<Message, _, Renderer>::new(content).style(|theme| {
let cosmic = theme.cosmic(); let cosmic = theme.cosmic();
let corners = cosmic.corner_radii.clone(); let corners = cosmic.corner_radii;
iced_widget::container::Style { iced_widget::container::Style {
text_color: Some(cosmic.background.on.into()), text_color: Some(cosmic.background.on.into()),
background: Some(Color::from(cosmic.background.base).into()), background: Some(Color::from(cosmic.background.base).into()),
@ -403,7 +401,7 @@ impl Context {
&self, &self,
content: impl Into<Element<'a, Message>>, content: impl Into<Element<'a, Message>>,
) -> Autosize<'a, Message, crate::Theme, crate::Renderer> { ) -> Autosize<'a, Message, crate::Theme, crate::Renderer> {
let force_configured = matches!(&self.panel_type, &PanelType::Other(ref n) if n.is_empty()); let force_configured = matches!(&self.panel_type, PanelType::Other(n) if n.is_empty());
let w = autosize(content, AUTOSIZE_MAIN_ID.clone()); let w = autosize(content, AUTOSIZE_MAIN_ID.clone());
let mut limits = Limits::NONE; let mut limits = Limits::NONE;
let suggested_window_size = self.suggested_window_size(); let suggested_window_size = self.suggested_window_size();
@ -414,7 +412,7 @@ impl Context {
.filter(|c| c.width as i32 > 0) .filter(|c| c.width as i32 > 0)
.map(|c| c.width) .map(|c| c.width)
{ {
limits = limits.width(width as f32); limits = limits.width(width);
} }
if let Some(height) = self if let Some(height) = self
.suggested_bounds .suggested_bounds
@ -422,7 +420,7 @@ impl Context {
.filter(|c| c.height as i32 > 0) .filter(|c| c.height as i32 > 0)
.map(|c| c.height) .map(|c| c.height)
{ {
limits = limits.height(height as f32); limits = limits.height(height);
} }
w.limits(limits) w.limits(limits)

View file

@ -17,7 +17,7 @@ const MONO_FAMILY_DEFAULT: &str = "Noto Sans Mono";
const SANS_FAMILY_DEFAULT: &str = "Open Sans"; const SANS_FAMILY_DEFAULT: &str = "Open Sans";
/// Stores static strings of the family names for `iced::Font` compatibility. /// Stores static strings of the family names for `iced::Font` compatibility.
pub static FAMILY_MAP: LazyLock<Mutex<BTreeSet<&'static str>>> = LazyLock::new(|| Mutex::default()); pub static FAMILY_MAP: LazyLock<Mutex<BTreeSet<&'static str>>> = LazyLock::new(Mutex::default);
pub static COSMIC_TK: LazyLock<RwLock<CosmicTk>> = LazyLock::new(|| { pub static COSMIC_TK: LazyLock<RwLock<CosmicTk>> = LazyLock::new(|| {
RwLock::new( RwLock::new(
@ -152,8 +152,7 @@ impl From<FontConfig> for iced::Font {
let mut family_map = FAMILY_MAP.lock().unwrap(); let mut family_map = FAMILY_MAP.lock().unwrap();
let name: &'static str = family_map let name: &'static str = family_map
.get(font.family.as_str()) .get(font.family.as_str()).copied()
.map(|&x| x)
.unwrap_or_else(|| { .unwrap_or_else(|| {
let value = font.family.clone().leak(); let value = font.family.clone().leak();
family_map.insert(value); family_map.insert(value);

View file

@ -74,10 +74,7 @@ pub fn load_applications<'a>(
#[cfg(not(windows))] #[cfg(not(windows))]
pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> bool { pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> bool {
let lowercase_wm_class = match entry.wm_class.as_ref() { let lowercase_wm_class = entry.wm_class.as_ref().map(|s| s.to_lowercase());
Some(s) => Some(s.to_lowercase()),
None => None,
};
app_id == entry.id app_id == entry.id
|| Some(app_id.to_lowercase()) == lowercase_wm_class || Some(app_id.to_lowercase()) == lowercase_wm_class

View file

@ -9,7 +9,7 @@ pub trait ElementExt {
fn debug(self, debug: bool) -> Self; fn debug(self, debug: bool) -> Self;
} }
impl<'a, Message: 'static> ElementExt for crate::Element<'a, Message> { impl<Message: 'static> ElementExt for crate::Element<'_, Message> {
fn debug(self, debug: bool) -> Self { fn debug(self, debug: bool) -> Self {
if debug { if debug {
self.explain(Color::WHITE) self.explain(Color::WHITE)

View file

@ -1,6 +1,5 @@
#[cfg(all(feature = "smol", not(feature = "tokio")))] #[cfg(all(feature = "smol", not(feature = "tokio")))]
use smol::io::AsyncReadExt; use smol::io::AsyncReadExt;
use std::fs::File;
use std::io; use std::io;
use std::os::fd::OwnedFd; use std::os::fd::OwnedFd;
use std::process::{exit, Command, Stdio}; use std::process::{exit, Command, Stdio};

View file

@ -6,7 +6,6 @@
use iced::window; use iced::window;
use iced::Task; use iced::Task;
use iced_core::window::Mode; use iced_core::window::Mode;
use iced_runtime::{task, Action};
use std::future::Future; use std::future::Future;
/// Yields a task which contains a batch of tasks. /// Yields a task which contains a batch of tasks.

View file

@ -754,7 +754,7 @@ impl menu::Catalog for Theme {
type Class<'a> = (); type Class<'a> = ();
fn default<'a>() -> <Self as menu::Catalog>::Class<'a> { fn default<'a>() -> <Self as menu::Catalog>::Class<'a> {
()
} }
fn style(&self, class: &<Self as menu::Catalog>::Class<'_>) -> menu::Style { fn style(&self, class: &<Self as menu::Catalog>::Class<'_>) -> menu::Style {
@ -777,7 +777,7 @@ impl pick_list::Catalog for Theme {
type Class<'a> = (); type Class<'a> = ();
fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> { fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> {
()
} }
fn style( fn style(
@ -822,7 +822,7 @@ impl radio::Catalog for Theme {
type Class<'a> = (); type Class<'a> = ();
fn default<'a>() -> Self::Class<'a> { fn default<'a>() -> Self::Class<'a> {
()
} }
fn style(&self, class: &Self::Class<'_>, status: radio::Status) -> radio::Style { fn style(&self, class: &Self::Class<'_>, status: radio::Status) -> radio::Style {
@ -876,7 +876,7 @@ impl toggler::Catalog for Theme {
type Class<'a> = (); type Class<'a> = ();
fn default<'a>() -> Self::Class<'a> { fn default<'a>() -> Self::Class<'a> {
()
} }
fn style(&self, class: &Self::Class<'_>, status: toggler::Status) -> toggler::Style { fn style(&self, class: &Self::Class<'_>, status: toggler::Status) -> toggler::Style {
@ -933,7 +933,7 @@ impl pane_grid::Catalog for Theme {
type Class<'a> = (); type Class<'a> = ();
fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> { fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> {
()
} }
fn style(&self, class: &<Self as pane_grid::Catalog>::Class<'_>) -> pane_grid::Style { fn style(&self, class: &<Self as pane_grid::Catalog>::Class<'_>) -> pane_grid::Style {

View file

@ -1,4 +1,4 @@
use iced::{Background, Color}; use iced::Color;
use crate::widget::wayland::tooltip::Catalog; use crate::widget::wayland::tooltip::Catalog;

View file

@ -183,7 +183,7 @@ pub fn about<'a, Message: Clone + 'static>(
.align_y(Alignment::Center), .align_y(Alignment::Center),
) )
.class(crate::theme::Button::Text) .class(crate::theme::Button::Text)
.on_press(on_url_press(url.unwrap_or(String::new()))) .on_press(on_url_press(url.unwrap_or_default()))
.width(Length::Fill), .width(Length::Fill),
) )
}); });

View file

@ -12,7 +12,6 @@ use iced_core::{
Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget, Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget,
}; };
use iced_widget::container;
pub use iced_widget::container::{Catalog, Style}; pub use iced_widget::container::{Catalog, Style};
pub fn aspect_ratio_container<'a, Message: 'static, T>( pub fn aspect_ratio_container<'a, Message: 'static, T>(
@ -35,7 +34,7 @@ where
container: Container<'a, Message, crate::Theme, Renderer>, container: Container<'a, Message, crate::Theme, Renderer>,
} }
impl<'a, Message, Renderer> AspectRatio<'a, Message, Renderer> impl<Message, Renderer> AspectRatio<'_, Message, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {
@ -146,8 +145,8 @@ where
} }
} }
impl<'a, Message, Renderer> Widget<Message, crate::Theme, Renderer> impl<Message, Renderer> Widget<Message, crate::Theme, Renderer>
for AspectRatio<'a, Message, Renderer> for AspectRatio<'_, Message, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {

View file

@ -1,6 +1,5 @@
//! Autosize Container, which will resize the window to its contents. //! Autosize Container, which will resize the window to its contents.
use cctk::sctk::shell::xdg::window;
use iced_core::event::{self, Event}; use iced_core::event::{self, Event};
use iced_core::layout; use iced_core::layout;
use iced_core::mouse; use iced_core::mouse;
@ -91,8 +90,8 @@ where
} }
} }
impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Autosize<'a, Message, Theme, Renderer> for Autosize<'_, Message, Theme, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {

View file

@ -29,7 +29,7 @@ pub fn icon<'a, Message>(handle: impl Into<Handle>) -> Button<'a, Message> {
}) })
} }
impl<'a, Message> Button<'a, Message> { impl<Message> Button<'_, Message> {
pub fn new(icon: Icon) -> Self { pub fn new(icon: Icon) -> Self {
let guard = crate::theme::THEME.lock().unwrap(); let guard = crate::theme::THEME.lock().unwrap();
let theme = guard.cosmic(); let theme = guard.cosmic();

View file

@ -1,7 +1,7 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
use super::{Builder, Style}; use super::Builder;
use crate::{ use crate::{
widget::{self, image::Handle}, widget::{self, image::Handle},
Element, Element,

View file

@ -111,7 +111,7 @@ pub struct Builder<'a, Message, Variant> {
variant: Variant, variant: Variant,
} }
impl<'a, Message, Variant> Builder<'a, Message, Variant> { impl<Message, Variant> Builder<'_, Message, Variant> {
/// Set the value of [`on_press`] as either `Some` or `None`. /// Set the value of [`on_press`] as either `Some` or `None`.
pub fn on_press_maybe(mut self, on_press: Option<Message>) -> Self { pub fn on_press_maybe(mut self, on_press: Option<Message>) -> Self {
self.on_press = on_press; self.on_press = on_press;

View file

@ -1,7 +1,7 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
use super::{Builder, ButtonClass, Style}; use super::{Builder, ButtonClass};
use crate::widget::{icon, row, tooltip}; use crate::widget::{icon, row, tooltip};
use crate::{ext::CollectionWidget, Element}; use crate::{ext::CollectionWidget, Element};
use apply::Apply; use apply::Apply;
@ -42,6 +42,12 @@ pub struct Text {
pub(super) trailing_icon: Option<icon::Handle>, pub(super) trailing_icon: Option<icon::Handle>,
} }
impl Default for Text {
fn default() -> Self {
Self::new()
}
}
impl Text { impl Text {
pub const fn new() -> Self { pub const fn new() -> Self {
Self { Self {
@ -51,7 +57,7 @@ impl Text {
} }
} }
impl<'a, Message> Button<'a, Message> { impl<Message> Button<'_, Message> {
pub fn new(text: Text) -> Self { pub fn new(text: Text) -> Self {
let guard = crate::theme::THEME.lock().unwrap(); let guard = crate::theme::THEME.lock().unwrap();
let theme = guard.cosmic(); let theme = guard.cosmic();

View file

@ -596,7 +596,7 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
node.set_described_by( node.set_described_by(
id.iter() id.iter()
.cloned() .cloned()
.map(|id| NodeId::from(id)) .map(NodeId::from)
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
); );
} }

View file

@ -53,7 +53,7 @@ impl CalendarModel {
let now = Local::now(); let now = Local::now();
let naive_now = NaiveDate::from(now.naive_local()); let naive_now = NaiveDate::from(now.naive_local());
CalendarModel { CalendarModel {
selected: naive_now.clone(), selected: naive_now,
visible: naive_now, visible: naive_now,
} }
} }
@ -65,36 +65,34 @@ impl CalendarModel {
pub fn show_prev_month(&mut self) { pub fn show_prev_month(&mut self) {
let prev_month_date = self let prev_month_date = self
.visible .visible
.clone()
.checked_sub_months(Months::new(1)) .checked_sub_months(Months::new(1))
.expect("valid naivedate"); .expect("valid naivedate");
self.visible = prev_month_date.clone(); self.visible = prev_month_date;
} }
pub fn show_next_month(&mut self) { pub fn show_next_month(&mut self) {
let next_month_date = self let next_month_date = self
.visible .visible
.clone()
.checked_add_months(Months::new(1)) .checked_add_months(Months::new(1))
.expect("valid naivedate"); .expect("valid naivedate");
self.visible = next_month_date.clone(); self.visible = next_month_date;
} }
pub fn set_prev_month(&mut self) { pub fn set_prev_month(&mut self) {
self.show_prev_month(); self.show_prev_month();
self.selected = self.visible.clone(); self.selected = self.visible;
} }
pub fn set_next_month(&mut self) { pub fn set_next_month(&mut self) {
self.show_next_month(); self.show_next_month();
self.selected = self.visible.clone(); self.selected = self.visible;
} }
pub fn set_selected_visible(&mut self, selected: NaiveDate) { pub fn set_selected_visible(&mut self, selected: NaiveDate) {
self.selected = selected; self.selected = selected;
self.visible = self.selected.clone(); self.visible = self.selected;
} }
} }

View file

@ -611,7 +611,7 @@ pub struct ColorPicker<'a, Message> {
must_clear_cache: Rc<AtomicBool>, must_clear_cache: Rc<AtomicBool>,
} }
impl<'a, Message> Widget<Message, crate::Theme, crate::Renderer> for ColorPicker<'a, Message> impl<Message> Widget<Message, crate::Theme, crate::Renderer> for ColorPicker<'_, Message>
where where
Message: Clone + 'static, Message: Clone + 'static,
{ {
@ -874,7 +874,7 @@ impl State {
} }
} }
impl<'a, Message> ColorPicker<'a, Message> where Message: Clone + 'static {} impl<Message> ColorPicker<'_, Message> where Message: Clone + 'static {}
// TODO convert active color to hex or rgba // TODO convert active color to hex or rgba
fn color_to_string(c: palette::Hsv, is_hex: bool) -> String { fn color_to_string(c: palette::Hsv, is_hex: bool) -> String {
let srgb = palette::Srgb::from_color(c); let srgb = palette::Srgb::from_color(c);

View file

@ -17,8 +17,8 @@ pub(super) struct Overlay<'a, 'b, Message> {
pub(super) width: f32, pub(super) width: f32,
} }
impl<'a, 'b, Message> overlay::Overlay<Message, crate::Theme, crate::Renderer> impl<Message> overlay::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'a, 'b, Message> for Overlay<'_, '_, Message>
where where
Message: Clone, Message: Clone,
{ {

View file

@ -155,7 +155,7 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
} }
} }
impl<'a, Message: Clone> Widget<Message, crate::Theme, Renderer> for ContextDrawer<'a, Message> { impl<Message: Clone> Widget<Message, crate::Theme, Renderer> for ContextDrawer<'_, Message> {
fn children(&self) -> Vec<Tree> { fn children(&self) -> Vec<Tree> {
vec![Tree::new(&self.content), Tree::new(&self.drawer)] vec![Tree::new(&self.content), Tree::new(&self.drawer)]
} }

View file

@ -46,8 +46,8 @@ pub struct ContextMenu<'a, Message> {
context_menu: Option<Vec<menu::Tree<'a, Message>>>, context_menu: Option<Vec<menu::Tree<'a, Message>>>,
} }
impl<'a, Message: Clone> Widget<Message, crate::Theme, crate::Renderer> impl<Message: Clone> Widget<Message, crate::Theme, crate::Renderer>
for ContextMenu<'a, Message> for ContextMenu<'_, Message>
{ {
fn tag(&self) -> tree::Tag { fn tag(&self) -> tree::Tag {
tree::Tag::of::<LocalState>() tree::Tag::of::<LocalState>()

View file

@ -15,6 +15,12 @@ pub struct Dialog<'a, Message> {
tertiary_action: Option<Element<'a, Message>>, tertiary_action: Option<Element<'a, Message>>,
} }
impl<Message> Default for Dialog<'_, Message> {
fn default() -> Self {
Self::new()
}
}
impl<'a, Message> Dialog<'a, Message> { impl<'a, Message> Dialog<'a, Message> {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {

View file

@ -243,8 +243,8 @@ impl<'a, Message: 'static> DndDestination<'a, Message> {
} }
} }
impl<'a, Message: 'static> Widget<Message, crate::Theme, crate::Renderer> impl<Message: 'static> Widget<Message, crate::Theme, crate::Renderer>
for DndDestination<'a, Message> for DndDestination<'_, Message>
{ {
fn children(&self) -> Vec<Tree> { fn children(&self) -> Vec<Tree> {
vec![Tree::new(&self.container)] vec![Tree::new(&self.container)]

View file

@ -111,7 +111,7 @@ impl<
clipboard, clipboard,
false, false,
if let Some(window) = self.window.as_ref() { if let Some(window) = self.window.as_ref() {
Some(iced_core::clipboard::DndSource::Surface(window.clone())) Some(iced_core::clipboard::DndSource::Surface(*window))
} else { } else {
Some(iced_core::clipboard::DndSource::Widget(self.id.clone())) Some(iced_core::clipboard::DndSource::Widget(self.id.clone()))
}, },
@ -153,10 +153,9 @@ impl<
} }
impl< impl<
'a,
Message: Clone + 'static, Message: Clone + 'static,
D: iced::clipboard::mime::AsMimeTypes + std::marker::Send + 'static, D: iced::clipboard::mime::AsMimeTypes + std::marker::Send + 'static,
> Widget<Message, crate::Theme, crate::Renderer> for DndSource<'a, Message, D> > Widget<Message, crate::Theme, crate::Renderer> for DndSource<'_, Message, D>
{ {
fn children(&self) -> Vec<Tree> { fn children(&self) -> Vec<Tree> {
vec![Tree::new(&self.container)] vec![Tree::new(&self.container)]

View file

@ -7,9 +7,8 @@ use std::borrow::Cow;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
pub use appearance::{Appearance, StyleSheet}; pub use appearance::{Appearance, StyleSheet};
use iced::advanced::widget;
use crate::widget::{icon, Container, RcElementWrapper, RcWrapper}; use crate::widget::{icon, Container, RcWrapper};
use iced_core::event::{self, Event}; use iced_core::event::{self, Event};
use iced_core::layout::{self, Layout}; use iced_core::layout::{self, Layout};
use iced_core::text::{self, Text}; use iced_core::text::{self, Text};
@ -418,8 +417,8 @@ where
text_line_height: text::LineHeight, text_line_height: text::LineHeight,
} }
impl<'a, S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer> impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer>
for List<'a, S, Message> for List<'_, S, Message>
where where
[S]: std::borrow::ToOwned, [S]: std::borrow::ToOwned,
{ {

View file

@ -14,13 +14,12 @@ pub use widget::*;
/// Displays a list of options in a popover menu on select. /// Displays a list of options in a popover menu on select.
pub fn dropdown< pub fn dropdown<
'a,
S: AsRef<str> + std::clone::Clone + Send + Sync + 'static, S: AsRef<str> + std::clone::Clone + Send + Sync + 'static,
Message: 'static + Clone, Message: 'static + Clone,
>( >(
selections: &'a [S], selections: &[S],
selected: Option<usize>, selected: Option<usize>,
on_selected: impl Fn(usize) -> Message + Send + Sync + 'static, on_selected: impl Fn(usize) -> Message + Send + Sync + 'static,
) -> Dropdown<'a, S, Message> { ) -> Dropdown<'_, S, Message> {
Dropdown::new(selections, selected, on_selected) Dropdown::new(selections, selected, on_selected)
} }

View file

@ -180,8 +180,8 @@ impl<'a, Message: 'a> Overlay<'a, Message> {
} }
} }
impl<'a, Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer> impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'a, Message> for Overlay<'_, Message>
{ {
fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node { fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node {
let position = self.position; let position = self.position;
@ -279,8 +279,8 @@ struct InnerList<'a, S, Item, Message> {
text_line_height: text::LineHeight, text_line_height: text::LineHeight,
} }
impl<'a, S, Item, Message> Widget<Message, crate::Theme, crate::Renderer> impl<S, Item, Message> Widget<Message, crate::Theme, crate::Renderer>
for InnerList<'a, S, Item, Message> for InnerList<'_, S, Item, Message>
where where
S: AsRef<str>, S: AsRef<str>,
Item: Clone + PartialEq, Item: Clone + PartialEq,

View file

@ -159,7 +159,7 @@ impl<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static>
cursor: mouse::Cursor, cursor: mouse::Cursor,
viewport: &Rectangle, viewport: &Rectangle,
) { ) {
let font = self.font.unwrap_or_else(|| crate::font::default()); let font = self.font.unwrap_or_else(crate::font::default);
draw( draw(
renderer, renderer,
@ -278,7 +278,7 @@ pub fn layout(
bounds: Size::new(f32::MAX, f32::MAX), bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size), size: iced::Pixels(text_size),
line_height: text_line_height, line_height: text_line_height,
font: font.unwrap_or_else(|| crate::font::default()), font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left, horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top, vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced, shaping: text::Shaping::Advanced,
@ -422,7 +422,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
bounds: Size::new(f32::MAX, f32::MAX), bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size), size: iced::Pixels(text_size),
line_height, line_height,
font: font.unwrap_or_else(|| crate::font::default()), font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left, horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top, vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced, shaping: text::Shaping::Advanced,

View file

@ -6,7 +6,7 @@ use super::menu::{self, Menu};
use crate::widget::icon::{self, Handle}; use crate::widget::icon::{self, Handle};
use crate::Element; use crate::Element;
use derive_setters::Setters; use derive_setters::Setters;
use iced::{window, Radians}; use iced::window;
use iced_core::event::{self, Event}; use iced_core::event::{self, Event};
use iced_core::text::{self, Paragraph, Text}; use iced_core::text::{self, Paragraph, Text};
use iced_core::widget::tree::{self, Tree}; use iced_core::widget::tree::{self, Tree};
@ -139,8 +139,8 @@ where
} }
} }
impl<'a, S: AsRef<str> + Send + Sync + Clone + 'static, Message: 'static + std::clone::Clone> impl<S: AsRef<str> + Send + Sync + Clone + 'static, Message: 'static + std::clone::Clone>
Widget<Message, crate::Theme, crate::Renderer> for Dropdown<'a, S, Message> Widget<Message, crate::Theme, crate::Renderer> for Dropdown<'_, S, Message>
where where
[S]: std::borrow::ToOwned, [S]: std::borrow::ToOwned,
{ {
@ -270,7 +270,7 @@ where
cursor: mouse::Cursor, cursor: mouse::Cursor,
viewport: &Rectangle, viewport: &Rectangle,
) { ) {
let font = self.font.unwrap_or_else(|| crate::font::default()); let font = self.font.unwrap_or_else(crate::font::default);
draw( draw(
renderer, renderer,
theme, theme,
@ -407,7 +407,7 @@ pub fn layout(
bounds: Size::new(f32::MAX, f32::MAX), bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size), size: iced::Pixels(text_size),
line_height: text_line_height, line_height: text_line_height,
font: font.unwrap_or_else(|| crate::font::default()), font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left, horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top, vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced, shaping: text::Shaping::Advanced,

View file

@ -85,8 +85,8 @@ impl<'a, Message> FlexRow<'a, Message> {
} }
} }
impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer>
for FlexRow<'a, Message> for FlexRow<'_, Message>
{ {
fn children(&self) -> Vec<Tree> { fn children(&self) -> Vec<Tree> {
self.children.iter().map(Tree::new).collect() self.children.iter().map(Tree::new).collect()

View file

@ -44,6 +44,12 @@ pub struct Grid<'a, Message> {
row: u16, row: u16,
} }
impl<Message> Default for Grid<'_, Message> {
fn default() -> Self {
Self::new()
}
}
impl<'a, Message> Grid<'a, Message> { impl<'a, Message> Grid<'a, Message> {
pub const fn new() -> Self { pub const fn new() -> Self {
Self { Self {
@ -106,7 +112,7 @@ impl<'a, Message> Grid<'a, Message> {
} }
} }
impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for Grid<'a, Message> { impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for Grid<'_, Message> {
fn children(&self) -> Vec<Tree> { fn children(&self) -> Vec<Tree> {
self.children.iter().map(Tree::new).collect() self.children.iter().map(Tree::new).collect()
} }
@ -303,6 +309,12 @@ pub struct Assignment {
pub(super) height: u16, pub(super) height: u16,
} }
impl Default for Assignment {
fn default() -> Self {
Self::new()
}
}
impl Assignment { impl Assignment {
pub const fn new() -> Self { pub const fn new() -> Self {
Self { Self {

View file

@ -120,8 +120,8 @@ pub struct HeaderBarWidget<'a, Message> {
header_bar_inner: Element<'a, Message>, header_bar_inner: Element<'a, Message>,
} }
impl<'a, Message: Clone + 'static> Widget<Message, crate::Theme, crate::Renderer> impl<Message: Clone + 'static> Widget<Message, crate::Theme, crate::Renderer>
for HeaderBarWidget<'a, Message> for HeaderBarWidget<'_, Message>
{ {
fn diff(&mut self, tree: &mut tree::Tree) { fn diff(&mut self, tree: &mut tree::Tree) {
tree.diff_children(&mut [&mut self.header_bar_inner]); tree.diff_children(&mut [&mut self.header_bar_inner]);

View file

@ -84,7 +84,7 @@ impl Icon {
self.height self.height
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))), .unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
) )
.rotation(self.rotation.unwrap_or_else(Rotation::default)) .rotation(self.rotation.unwrap_or_default())
.content_fit(self.content_fit) .content_fit(self.content_fit)
.into() .into()
}; };
@ -100,7 +100,7 @@ impl Icon {
self.height self.height
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))), .unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
) )
.rotation(self.rotation.unwrap_or_else(Rotation::default)) .rotation(self.rotation.unwrap_or_default())
.content_fit(self.content_fit) .content_fit(self.content_fit)
.symbolic(self.handle.symbolic) .symbolic(self.handle.symbolic)
.into() .into()

View file

@ -144,7 +144,7 @@ impl From<Named> for Icon {
} }
} }
impl<'a, Message: 'static> From<Named> for crate::Element<'a, Message> { impl<Message: 'static> From<Named> for crate::Element<'_, Message> {
fn from(builder: Named) -> Self { fn from(builder: Named) -> Self {
builder.icon().into() builder.icon().into()
} }

View file

@ -47,8 +47,8 @@ where
} }
} }
impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for IdContainer<'a, Message, Theme, Renderer> for IdContainer<'_, Message, Theme, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {

View file

@ -138,8 +138,8 @@ where
} }
} }
impl<'a, Message, Renderer> Widget<Message, Theme, Renderer> impl<Message, Renderer> Widget<Message, Theme, Renderer>
for LayerContainer<'a, Message, Renderer> for LayerContainer<'_, Message, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {

View file

@ -24,7 +24,7 @@ pub struct ListColumn<'a, Message> {
children: Vec<Element<'a, Message>>, children: Vec<Element<'a, Message>>,
} }
impl<'a, Message: 'static> Default for ListColumn<'a, Message> { impl<Message: 'static> Default for ListColumn<'_, Message> {
fn default() -> Self { fn default() -> Self {
let cosmic_theme::Spacing { let cosmic_theme::Spacing {
space_xxs, space_m, .. space_xxs, space_m, ..

View file

@ -40,7 +40,7 @@ impl KeyBind {
pub fn matches(&self, modifiers: Modifiers, key: &Key) -> bool { pub fn matches(&self, modifiers: Modifiers, key: &Key) -> bool {
let key_eq = match (key, &self.key) { let key_eq = match (key, &self.key) {
// CapsLock and Shift change the case of Key::Character, so we compare these in a case insensitive way // CapsLock and Shift change the case of Key::Character, so we compare these in a case insensitive way
(Key::Character(a), Key::Character(b)) => a.eq_ignore_ascii_case(&b), (Key::Character(a), Key::Character(b)) => a.eq_ignore_ascii_case(b),
(a, b) => a.eq(b), (a, b) => a.eq(b),
}; };
key_eq key_eq

View file

@ -64,8 +64,8 @@ impl Default for MenuBarState {
} }
} }
pub(crate) fn menu_roots_children<'a, Message, Renderer>( pub(crate) fn menu_roots_children<Message, Renderer>(
menu_roots: &Vec<MenuTree<'a, Message, Renderer>>, menu_roots: &Vec<MenuTree<'_, Message, Renderer>>,
) -> Vec<Tree> ) -> Vec<Tree>
where where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
@ -95,8 +95,8 @@ where
} }
#[allow(invalid_reference_casting)] #[allow(invalid_reference_casting)]
pub(crate) fn menu_roots_diff<'a, Message, Renderer>( pub(crate) fn menu_roots_diff<Message, Renderer>(
menu_roots: &mut Vec<MenuTree<'a, Message, Renderer>>, menu_roots: &mut Vec<MenuTree<'_, Message, Renderer>>,
tree: &mut Tree, tree: &mut Tree,
) where ) where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
@ -280,8 +280,8 @@ where
self self
} }
} }
impl<'a, Message, Renderer> Widget<Message, crate::Theme, Renderer> impl<Message, Renderer> Widget<Message, crate::Theme, Renderer>
for MenuBar<'a, Message, Renderer> for MenuBar<'_, Message, Renderer>
where where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
{ {

View file

@ -447,7 +447,7 @@ where
pub(crate) style: &'b <crate::Theme as StyleSheet>::Style, pub(crate) style: &'b <crate::Theme as StyleSheet>::Style,
pub(crate) position: Point, pub(crate) position: Point,
} }
impl<'a, 'b, Message, Renderer> Menu<'a, 'b, Message, Renderer> impl<'b, Message, Renderer> Menu<'_, 'b, Message, Renderer>
where where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
{ {
@ -455,8 +455,8 @@ where
overlay::Element::new(Box::new(self)) overlay::Element::new(Box::new(self))
} }
} }
impl<'a, 'b, Message, Renderer> overlay::Overlay<Message, crate::Theme, Renderer> impl<Message, Renderer> overlay::Overlay<Message, crate::Theme, Renderer>
for Menu<'a, 'b, Message, Renderer> for Menu<'_, '_, Message, Renderer>
where where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
{ {

View file

@ -344,7 +344,7 @@ pub mod wayland;
pub mod tooltip { pub mod tooltip {
use crate::Element; use crate::Element;
use std::borrow::Cow;
pub use iced::widget::tooltip::Position; pub use iced::widget::tooltip::Position;

View file

@ -25,7 +25,7 @@ pub fn nav_bar_toggle<Message>() -> NavBarToggle<Message> {
} }
} }
impl<'a, Message: 'static + Clone> From<NavBarToggle<Message>> for Element<'a, Message> { impl<Message: 'static + Clone> From<NavBarToggle<Message>> for Element<'_, Message> {
fn from(nav_bar_toggle: NavBarToggle<Message>) -> Self { fn from(nav_bar_toggle: NavBarToggle<Message>) -> Self {
let icon = if nav_bar_toggle.active { let icon = if nav_bar_toggle.active {
widget::icon::from_svg_bytes( widget::icon::from_svg_bytes(

View file

@ -75,8 +75,8 @@ impl<'a, Message, Renderer> Popover<'a, Message, Renderer> {
// TODO More options for positioning similar to GdkPopup, xdg_popup // TODO More options for positioning similar to GdkPopup, xdg_popup
} }
impl<'a, Message: Clone, Renderer> Widget<Message, crate::Theme, Renderer> impl<Message: Clone, Renderer> Widget<Message, crate::Theme, Renderer>
for Popover<'a, Message, Renderer> for Popover<'_, Message, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {
@ -305,8 +305,8 @@ pub struct Overlay<'a, 'b, Message, Renderer> {
pos: Point, pos: Point,
} }
impl<'a, 'b, Message, Renderer> overlay::Overlay<Message, crate::Theme, Renderer> impl<Message, Renderer> overlay::Overlay<Message, crate::Theme, Renderer>
for Overlay<'a, 'b, Message, Renderer> for Overlay<'_, '_, Message, Renderer>
where where
Message: Clone, Message: Clone,
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
@ -425,7 +425,7 @@ where
) -> Option<overlay::Element<'c, Message, crate::Theme, Renderer>> { ) -> Option<overlay::Element<'c, Message, crate::Theme, Renderer>> {
self.content self.content
.as_widget_mut() .as_widget_mut()
.overlay(&mut self.tree, layout, renderer, Default::default()) .overlay(self.tree, layout, renderer, Default::default())
} }
} }

View file

@ -155,7 +155,7 @@ where
} }
} }
impl<'a, Message, Renderer> Widget<Message, Theme, Renderer> for Radio<'a, Message, Renderer> impl<Message, Renderer> Widget<Message, Theme, Renderer> for Radio<'_, Message, Renderer>
where where
Message: Clone, Message: Clone,
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,

View file

@ -58,8 +58,8 @@ where
} }
} }
impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for ResponsiveContainer<'a, Message, Theme, Renderer> for ResponsiveContainer<'_, Message, Theme, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
Message: From<SurfaceMessage>, Message: From<SurfaceMessage>,

View file

@ -30,8 +30,8 @@ where
SegmentedButton::new(model) SegmentedButton::new(model)
} }
impl<'a, SelectionMode, Message> SegmentedVariant impl<SelectionMode, Message> SegmentedVariant
for SegmentedButton<'a, Horizontal, SelectionMode, Message> for SegmentedButton<'_, Horizontal, SelectionMode, Message>
where where
Model<SelectionMode>: Selectable, Model<SelectionMode>: Selectable,
SelectionMode: Default, SelectionMode: Default,

View file

@ -15,7 +15,7 @@ pub struct EntityMut<'a, SelectionMode: Default> {
pub(super) model: &'a mut Model<SelectionMode>, pub(super) model: &'a mut Model<SelectionMode>,
} }
impl<'a, SelectionMode: Default> EntityMut<'a, SelectionMode> impl<SelectionMode: Default> EntityMut<'_, SelectionMode>
where where
Model<SelectionMode>: Selectable, Model<SelectionMode>: Selectable,
{ {

View file

@ -30,8 +30,8 @@ where
SegmentedButton::new(model) SegmentedButton::new(model)
} }
impl<'a, SelectionMode, Message> SegmentedVariant impl<SelectionMode, Message> SegmentedVariant
for SegmentedButton<'a, Vertical, SelectionMode, Message> for SegmentedButton<'_, Vertical, SelectionMode, Message>
where where
Model<SelectionMode>: Selectable, Model<SelectionMode>: Selectable,
SelectionMode: Default, SelectionMode: Default,

View file

@ -547,8 +547,8 @@ where
} }
} }
impl<'a, Variant, SelectionMode, Message> Widget<Message, crate::Theme, Renderer> impl<Variant, SelectionMode, Message> Widget<Message, crate::Theme, Renderer>
for SegmentedButton<'a, Variant, SelectionMode, Message> for SegmentedButton<'_, Variant, SelectionMode, Message>
where where
Self: SegmentedVariant, Self: SegmentedVariant,
Model<SelectionMode>: Selectable, Model<SelectionMode>: Selectable,
@ -562,7 +562,7 @@ where
if let Some(ref context_menu) = self.context_menu { if let Some(ref context_menu) = self.context_menu {
let mut tree = Tree::empty(); let mut tree = Tree::empty();
tree.state = tree::State::new(MenuBarState::default()); tree.state = tree::State::new(MenuBarState::default());
tree.children = menu_roots_children(&context_menu); tree.children = menu_roots_children(context_menu);
children.push(tree); children.push(tree);
} }
@ -719,7 +719,7 @@ where
let on_dnd_enter = let on_dnd_enter =
self.on_dnd_enter self.on_dnd_enter
.as_ref() .as_ref()
.zip(entity.clone()) .zip(entity)
.map(|(on_enter, entity)| { .map(|(on_enter, entity)| {
move |_, _, mime_types| on_enter(entity, mime_types) move |_, _, mime_types| on_enter(entity, mime_types)
}); });

View file

@ -20,9 +20,9 @@ pub fn section<'a, Message: 'static>() -> Section<'a, Message> {
} }
/// A section with a pre-defined list column. /// A section with a pre-defined list column.
pub fn with_column<'a, Message: 'static>( pub fn with_column<Message: 'static>(
children: ListColumn<'a, Message>, children: ListColumn<'_, Message>,
) -> Section<'a, Message> { ) -> Section<'_, Message> {
Section { Section {
title: Cow::Borrowed(""), title: Cow::Borrowed(""),
children, children,

View file

@ -9,12 +9,10 @@ use crate::{
Element, Element,
}; };
use apply::Apply; use apply::Apply;
use derive_setters::Setters; use iced::{Border, Shadow};
use iced::{alignment::Horizontal, Border, Shadow};
use iced::{Alignment, Length}; use iced::{Alignment, Length};
use std::marker::PhantomData;
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
use std::{borrow::Cow, fmt::Display}; use std::borrow::Cow;
/// Horizontal spin button widget. /// Horizontal spin button widget.
pub fn spin_button<'a, T, M>( pub fn spin_button<'a, T, M>(
@ -153,9 +151,9 @@ where
} }
} }
fn horizontal_variant<'a, T, Message>( fn horizontal_variant<T, Message>(
spin_button: SpinButton<'a, T, Message>, spin_button: SpinButton<'_, T, Message>,
) -> Element<'a, Message> ) -> Element<'_, Message>
where where
Message: Clone + 'static, Message: Clone + 'static,
T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd, T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd,
@ -193,7 +191,7 @@ where
.into() .into()
} }
fn vertical_variant<'a, T, Message>(spin_button: SpinButton<'a, T, Message>) -> Element<'a, Message> fn vertical_variant<T, Message>(spin_button: SpinButton<'_, T, Message>) -> Element<'_, Message>
where where
Message: Clone + 'static, Message: Clone + 'static,
T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd, T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd,

View file

@ -18,7 +18,6 @@ use super::style::StyleSheet;
pub use super::value::Value; pub use super::value::Value;
use apply::Apply; use apply::Apply;
use cosmic_theme::Theme;
use iced::clipboard::dnd::{DndAction, DndEvent, OfferEvent, SourceEvent}; use iced::clipboard::dnd::{DndAction, DndEvent, OfferEvent, SourceEvent};
use iced::clipboard::mime::AsMimeTypes; use iced::clipboard::mime::AsMimeTypes;
use iced::Limits; use iced::Limits;
@ -40,10 +39,6 @@ use iced_core::{
Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point, Rectangle, Shell, Size, Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point, Rectangle, Shell, Size,
Vector, Widget, Vector, Widget,
}; };
#[cfg(feature = "wayland")]
use iced_renderer::core::event::{wayland, PlatformSpecific};
#[cfg(feature = "wayland")]
use iced_runtime::platform_specific;
use iced_runtime::{task, Action, Task}; use iced_runtime::{task, Action, Task};
thread_local! { thread_local! {
@ -343,7 +338,7 @@ where
/// Sets the message that should be produced when the [`TextInput`] is /// Sets the message that should be produced when the [`TextInput`] is
/// focused and the enter key is pressed. /// focused and the enter key is pressed.
pub fn on_submit<F>(mut self, callback: F) -> Self pub fn on_submit<F>(self, callback: F) -> Self
where where
F: 'a + Fn(String) -> Message, F: 'a + Fn(String) -> Message,
{ {
@ -526,7 +521,7 @@ where
} }
} }
impl<'a, Message> Widget<Message, crate::Theme, crate::Renderer> for TextInput<'a, Message> impl<Message> Widget<Message, crate::Theme, crate::Renderer> for TextInput<'_, Message>
where where
Message: Clone + 'static, Message: Clone + 'static,
{ {
@ -605,13 +600,10 @@ where
// if the previous state was at the end of the text, keep it there // if the previous state was at the end of the text, keep it there
let old_value = Value::new(&old_value); let old_value = Value::new(&old_value);
if state.is_focused.is_some() { if state.is_focused.is_some() {
match state.cursor.state(&old_value) { if let cursor::State::Index(index) = state.cursor.state(&old_value) {
cursor::State::Index(index) => {
if index == old_value.len() { if index == old_value.len() {
state.cursor.move_to(self.value.len()); state.cursor.move_to(self.value.len());
} }
}
_ => {}
}; };
} }
@ -808,7 +800,7 @@ where
} }
} }
if tree.children.len() > 0 { if !tree.children.is_empty() {
let index = tree.children.len() - 1; let index = tree.children.len() - 1;
if let (Some(trailing_icon), Some(tree)) = if let (Some(trailing_icon), Some(tree)) =
(self.trailing_icon.as_mut(), tree.children.get_mut(index)) (self.trailing_icon.as_mut(), tree.children.get_mut(index))
@ -1387,7 +1379,7 @@ where
iced_core::clipboard::start_dnd( iced_core::clipboard::start_dnd(
clipboard, clipboard,
false, false,
id.map(|id| iced_core::clipboard::DndSource::Widget(id)), id.map(iced_core::clipboard::DndSource::Widget),
Some(iced_core::clipboard::IconSurface::new( Some(iced_core::clipboard::IconSurface::new(
Element::from( Element::from(
TextInput::<'static, ()>::new("", input_text.clone()) TextInput::<'static, ()>::new("", input_text.clone())
@ -1583,7 +1575,7 @@ where
match key { match key {
keyboard::Key::Named(keyboard::key::Named::Enter) => { keyboard::Key::Named(keyboard::key::Named::Enter) => {
if let Some(on_submit) = on_submit.clone() { if let Some(on_submit) = on_submit {
shell.publish((on_submit)(unsecured_value.to_string())); shell.publish((on_submit)(unsecured_value.to_string()));
} }
} }

View file

@ -8,7 +8,7 @@ use std::rc::Rc;
use crate::widget::container; use crate::widget::container;
use crate::widget::Column; use crate::widget::Column;
use iced::{Padding, Task}; use iced::Task;
use iced_core::Element; use iced_core::Element;
use slotmap::new_key_type; use slotmap::new_key_type;
use slotmap::SlotMap; use slotmap::SlotMap;

View file

@ -35,8 +35,8 @@ impl<'a, Message, Theme, Renderer> Toaster<'a, Message, Theme, Renderer> {
} }
} }
impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Toaster<'a, Message, Theme, Renderer> for Toaster<'_, Message, Theme, Renderer>
where where
Renderer: iced_core::Renderer, Renderer: iced_core::Renderer,
{ {
@ -191,8 +191,8 @@ where
} }
} }
impl<'a, 'b, Message, Theme, Renderer> Overlay<Message, Theme, Renderer> impl<Message, Theme, Renderer> Overlay<Message, Theme, Renderer>
for ToasterOverlay<'a, 'b, Message, Theme, Renderer> for ToasterOverlay<'_, '_, Message, Theme, Renderer>
where where
Renderer: renderer::Renderer, Renderer: renderer::Renderer,
{ {

View file

@ -7,10 +7,9 @@
//! A [`Tooltip`] has some local [`State`]. //! A [`Tooltip`] has some local [`State`].
use iced_runtime::core::widget::Id; use iced_runtime::core::widget::Id;
use iced_runtime::{keyboard, task, Action, Task};
use iced_core::event::{self, Event}; use iced_core::event::{self, Event};
use iced_core::renderer::{self, Quad, Renderer}; use iced_core::renderer::{self, Renderer};
use iced_core::touch; use iced_core::touch;
use iced_core::widget::tree::{self, Tree}; use iced_core::widget::tree::{self, Tree};
use iced_core::widget::Operation; use iced_core::widget::Operation;
@ -20,9 +19,7 @@ use iced_core::{overlay, Shadow};
use iced_core::{ use iced_core::{
Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget, Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget,
}; };
use iced_renderer::core::widget::operation;
use crate::theme::THEME;
pub use super::{Catalog, Style}; pub use super::{Catalog, Style};
@ -267,7 +264,7 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
let styling = theme.style(&self.style); let styling = theme.style(&self.style);
let mut icon_color = styling.icon_color.unwrap_or(renderer_style.icon_color); let icon_color = styling.icon_color.unwrap_or(renderer_style.icon_color);
draw::<_, crate::Theme>( draw::<_, crate::Theme>(
renderer, renderer,