fix: unused import and variable warnings

This commit is contained in:
Adam Cosner 2026-04-08 02:05:20 -04:00
parent 47b5410253
commit 900b624fde
36 changed files with 192 additions and 189 deletions

View file

@ -408,7 +408,7 @@ where
f64::from(self.app.core().scale_factor())
}
pub fn style(&self, theme: &Theme) -> theme::Style {
pub fn style(&self, _theme: &Theme) -> theme::Style {
if let Some(style) = self.app.style() {
style
} else if self.app.core().window.is_maximized {

View file

@ -133,7 +133,7 @@ pub fn run<App: Application>(settings: Settings, flags: App::Flags) -> iced::Res
crate::malloc::limit_mmap_threshold(threshold);
}
let default_font = settings.default_font;
// let default_font = settings.default_font;
let (settings, (mut core, flags), window_settings) = iced_settings::<App>(settings, flags);
#[cfg(not(feature = "multi-window"))]
{

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
use iced::Color;
use iced_core::Widget;
pub trait ElementExt {
#[must_use]

View file

@ -1,4 +1,3 @@
use iced::Task;
use iced::mouse::ScrollDelta;
use std::time::{Duration, Instant};

View file

@ -1,11 +1,19 @@
// Copyright 2025 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
#[cfg(any(
all(feature = "wayland", target_os = "linux"),
all(feature = "wayland", target_os = "linux", feature = "winit")
))]
use super::Action;
#[cfg(feature = "winit")]
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
use crate::Application;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
use iced::window;
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
use std::{any::Any, sync::Arc};
/// Used to produce a destroy popup message from within a widget.

View file

@ -6,7 +6,6 @@ pub mod action;
use iced::Limits;
use iced::Size;
use iced::Task;
use std::future::Future;
use std::sync::Arc;
/// Ignore this message in your application. It will be intercepted.

View file

@ -8,12 +8,12 @@ pub mod portal;
pub mod style;
use cosmic_config::CosmicConfigEntry;
use cosmic_config::config_subscription;
//use cosmic_config::config_subscription;
use cosmic_theme::Component;
use cosmic_theme::LayeredTheme;
use cosmic_theme::Spacing;
use cosmic_theme::ThemeMode;
use iced_futures::Subscription;
//use iced_futures::Subscription;
use iced_runtime::{Appearance, DefaultStyle};
use std::sync::{Arc, LazyLock, Mutex};
pub use style::*;

View file

@ -792,7 +792,7 @@ impl menu::Catalog for Theme {
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 {
let cosmic = self.cosmic();
menu::Style {
@ -816,7 +816,7 @@ impl pick_list::Catalog for Theme {
fn style(
&self,
class: &<Self as pick_list::Catalog>::Class<'_>,
_class: &<Self as pick_list::Catalog>::Class<'_>,
status: pick_list::Status,
) -> pick_list::Style {
let cosmic = &self.cosmic();
@ -857,7 +857,7 @@ impl radio::Catalog for Theme {
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 {
let cur_container = self.current_container();
let theme = self.cosmic();
@ -910,7 +910,7 @@ impl toggler::Catalog for Theme {
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 {
let cosmic = self.cosmic();
const HANDLE_MARGIN: f32 = 2.0;
let neutral_10 = cosmic.palette.neutral_10.with_alpha(0.1);
@ -938,8 +938,8 @@ impl toggler::Catalog for Theme {
padding_ratio: 0.0,
};
match status {
toggler::Status::Active { is_toggled } => active,
toggler::Status::Hovered { is_toggled } => {
toggler::Status::Active { .. } => active,
toggler::Status::Hovered { .. } => {
let is_active = matches!(status, toggler::Status::Hovered { is_toggled: true });
toggler::Style {
background: if is_active {
@ -958,7 +958,7 @@ impl toggler::Catalog for Theme {
..active
}
}
toggler::Status::Disabled { is_toggled } => {
toggler::Status::Disabled { .. } => {
active.background = active.background.scale_alpha(0.5);
active.foreground = active.foreground.scale_alpha(0.5);
active
@ -975,7 +975,7 @@ impl pane_grid::Catalog for Theme {
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 {
let theme = self.cosmic();
pane_grid::Style {
@ -1142,10 +1142,7 @@ impl scrollable::Catalog for Theme {
fn style(&self, class: &Self::Class<'_>, status: scrollable::Status) -> scrollable::Style {
match status {
scrollable::Status::Active {
is_horizontal_scrollbar_disabled,
is_vertical_scrollbar_disabled,
} => {
scrollable::Status::Active { .. } => {
let cosmic = self.cosmic();
let neutral_5 = cosmic.palette.neutral_5.with_alpha(0.7);
let neutral_6 = cosmic.palette.neutral_6.with_alpha(0.7);
@ -1303,7 +1300,7 @@ impl svg::Catalog for Theme {
Svg::default()
}
fn style(&self, class: &Self::Class<'_>, status: svg::Status) -> svg::Style {
fn style(&self, class: &Self::Class<'_>, _status: svg::Status) -> svg::Style {
#[allow(clippy::match_same_arms)]
match class {
Svg::Default => svg::Style::default(),
@ -1433,7 +1430,7 @@ impl text_input::Catalog for Theme {
},
}
}
text_input::Status::Focused { is_hovered } => {
text_input::Status::Focused { .. } => {
let bg = self.current_container().small_widget.with_alpha(0.25);
match class {
@ -1510,7 +1507,7 @@ impl iced_widget::text_editor::Catalog for Theme {
let selection = cosmic.accent.base.into();
let value = cosmic.palette.neutral_9.into();
let placeholder = cosmic.palette.neutral_9.with_alpha(0.7).into();
let icon: Color = cosmic.background.on.into();
// let icon: Color = cosmic.background.on.into();
// TODO do we need to add icon color back?
match status {
@ -1527,19 +1524,17 @@ impl iced_widget::text_editor::Catalog for Theme {
value,
selection,
},
iced_widget::text_editor::Status::Focused { is_hovered } => {
iced_widget::text_editor::Style {
background: iced::Color::from(cosmic.bg_color()).into(),
border: Border {
radius: cosmic.corner_radii.radius_0.into(),
width: f32::from(cosmic.space_xxxs()),
color: iced::Color::from(cosmic.accent.base),
},
placeholder,
value,
selection,
}
}
iced_widget::text_editor::Status::Focused { .. } => iced_widget::text_editor::Style {
background: iced::Color::from(cosmic.bg_color()).into(),
border: Border {
radius: cosmic.corner_radii.radius_0.into(),
width: f32::from(cosmic.space_xxxs()),
color: iced::Color::from(cosmic.accent.base),
},
placeholder,
value,
selection,
},
}
}
}
@ -1630,8 +1625,8 @@ impl Base for Theme {
crate::theme::ThemeType::Light => "Cosmic Light Theme",
crate::theme::ThemeType::HighContrastDark => "Cosmic High Contrast Dark Theme",
crate::theme::ThemeType::HighContrastLight => "Cosmic High Contrast Light Theme",
crate::theme::ThemeType::Custom(theme) => "Custom Cosmic Theme",
crate::theme::ThemeType::System { prefer_dark, theme } => &theme.name,
crate::theme::ThemeType::Custom(_theme) => "Custom Cosmic Theme",
crate::theme::ThemeType::System { theme, .. } => &theme.name,
}
}
}

View file

@ -181,7 +181,7 @@ mod horizontal {
pub fn selection_active(
cosmic: &cosmic_theme::Theme,
component: &Component,
_component: &Component,
) -> ItemStatusAppearance {
let rad_xl = cosmic.corner_radii.radius_xl;
let rad_0 = cosmic.corner_radii.radius_0;
@ -275,7 +275,7 @@ mod vertical {
pub fn selection_active(
cosmic: &cosmic_theme::Theme,
component: &Component,
_component: &Component,
) -> ItemStatusAppearance {
let rad_0 = cosmic.corner_radii.radius_0;
let rad_xl = cosmic.corner_radii.radius_xl;

View file

@ -1,6 +1,8 @@
//! Autosize Container, which will resize the window to its contents.
use iced_core::event::{self, Event};
#[cfg(all(feature = "wayland", target_os = "linux"))]
use iced::core::event;
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -9,7 +9,7 @@
use iced_runtime::core::widget::Id;
use iced_runtime::{Action, Task, keyboard, task};
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::renderer::{self, Quad, Renderer};
use iced_core::touch;
use iced_core::widget::Operation;
@ -667,7 +667,7 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
height,
} = layout.bounds();
let bounds = Rect::new(x as f64, y as f64, (x + width) as f64, (y + height) as f64);
let is_hovered = state.state.downcast_ref::<State>().is_hovered;
//let is_hovered = state.state.downcast_ref::<State>().is_hovered;
let mut node = Node::new(Role::Button);
node.add_action(Action::Focus);
@ -827,7 +827,7 @@ pub fn update<'a, Message: Clone>(
}
}
#[cfg(feature = "a11y")]
Event::A11y(event_id, iced_accessibility::accesskit::ActionRequest { action, .. }) => {
Event::A11y(_event_id, iced_accessibility::accesskit::ActionRequest { action, .. }) => {
let state = state();
if let Some(on_press) = matches!(action, iced_accessibility::accesskit::Action::Click)
.then_some(on_press)
@ -870,7 +870,7 @@ pub fn draw<Renderer: iced_core::Renderer, Theme>(
viewport_bounds: Rectangle,
styling: &super::style::Style,
draw_contents: impl FnOnce(&mut Renderer, &Style),
is_image: bool,
_is_image: bool,
) where
Theme: super::style::Catalog,
{

View file

@ -98,7 +98,7 @@ where
/// Get an expandable stack of cards
#[allow(clippy::too_many_arguments)]
pub fn new<F, G>(
id: widget::Id,
_id: widget::Id,
card_inner_elements: Vec<Element<'a, Message, crate::Theme, crate::Renderer>>,
on_clear_all: Message,
on_show_more: Option<F>,

View file

@ -15,7 +15,7 @@ use crate::theme::{Button, THEME};
use crate::widget::{button::Catalog, container, segmented_button::Entity, slider};
use derive_setters::Setters;
use iced::Task;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::gradient::{ColorStop, Linear};
use iced_core::renderer::Quad;
use iced_core::widget::{Tree, tree};

View file

@ -11,9 +11,15 @@
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
use crate::widget::menu::{
self, CloseCondition, Direction, ItemHeight, ItemWidth, MenuBarState, PathHighlight,
init_root_menu, menu_roots_diff,
self, CloseCondition, ItemHeight, ItemWidth, MenuBarState, PathHighlight, menu_roots_diff,
};
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
use crate::widget::menu::{Direction, init_root_menu};
use derive_setters::Setters;
use iced::touch::Finger;
use iced::{Event, Vector, keyboard, window};

View file

@ -9,7 +9,7 @@ use crate::{
use iced::{
Event, Length, Point, Rectangle, Vector,
clipboard::dnd::{DndAction, DndEvent, SourceEvent},
event, mouse, overlay,
mouse, overlay,
};
use iced_core::{
self, Clipboard, Shell, layout, renderer,

View file

@ -8,9 +8,8 @@ use std::sync::{Arc, Mutex};
pub use appearance::{Appearance, StyleSheet};
use crate::surface;
use crate::widget::{Container, RcWrapper, icon};
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout::{self, Layout};
use iced_core::text::{self, Text};
use iced_core::widget::Tree;
@ -391,7 +390,7 @@ impl<'a, Message: Clone + 'a> crate::widget::Widget<Message, crate::Theme, crate
fn draw(
&self,
tree: &Tree,
_tree: &Tree,
renderer: &mut crate::Renderer,
theme: &crate::Theme,
style: &renderer::Style,
@ -554,12 +553,12 @@ where
fn draw(
&self,
state: &Tree,
_state: &Tree,
renderer: &mut crate::Renderer,
theme: &crate::Theme,
style: &renderer::Style,
_style: &renderer::Style,
layout: Layout<'_>,
cursor: mouse::Cursor,
_cursor: mouse::Cursor,
viewport: &Rectangle,
) {
let appearance = theme.appearance(&());

View file

@ -2,7 +2,7 @@ use super::Model;
pub use crate::widget::dropdown::menu::{Appearance, StyleSheet};
use crate::widget::Container;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout::{self, Layout};
use iced_core::text::{self, Text};
use iced_core::widget::Tree;

View file

@ -5,15 +5,14 @@
use super::menu::{self, Menu};
use crate::widget::icon;
use derive_setters::Setters;
use iced_core::event::{self, Event};
use iced_core::text::{self, Paragraph, Text};
use iced_core::event::Event;
use iced_core::text::{self, Text};
use iced_core::widget::tree::{self, Tree};
use iced_core::{
Clipboard, Layout, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget,
};
use iced_core::{Shadow, alignment, keyboard, layout, mouse, overlay, renderer, svg, touch};
use iced_widget::pick_list;
use std::ffi::OsStr;
pub use iced_widget::pick_list::{Catalog, Style};
@ -253,7 +252,7 @@ impl<Item: Clone + PartialEq + 'static> Default for State<Item> {
/// Computes the layout of a [`Dropdown`].
#[allow(clippy::too_many_arguments)]
pub fn layout(
renderer: &crate::Renderer,
_renderer: &crate::Renderer,
limits: &layout::Limits,
width: Length,
gap: f32,
@ -376,7 +375,7 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor) -> mouse::In
#[allow(clippy::too_many_arguments)]
pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static>(
layout: Layout<'_>,
renderer: &crate::Renderer,
_renderer: &crate::Renderer,
state: &'a mut State<Item>,
gap: f32,
padding: Padding,

View file

@ -2,9 +2,9 @@
// SPDX-License-Identifier: MPL-2.0 AND MIT
//! Operate on dropdown widgets.
use super::State;
use iced::Rectangle;
use iced_core::widget::{Id, Operation};
//use super::State;
//use iced::Rectangle;
//use iced_core::widget::{Id, Operation};
pub trait Dropdown {
fn close(&mut self);

View file

@ -4,11 +4,14 @@
use super::Id;
use super::menu::{self, Menu};
use crate::widget::icon::{self, Handle};
use crate::widget::icon;
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
use crate::widget::icon::Handle;
use crate::{Element, surface};
use derive_setters::Setters;
use iced::window;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::text::{self, Paragraph, Text};
use iced_core::widget::tree::{self, Tree};
use iced_core::{
@ -17,7 +20,6 @@ use iced_core::{
use iced_core::{Shadow, alignment, keyboard, layout, mouse, overlay, renderer, svg, touch};
use iced_widget::pick_list::{self, Catalog};
use std::borrow::Cow;
use std::ffi::OsStr;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, LazyLock, Mutex};
@ -328,10 +330,10 @@ where
fn operate(
&mut self,
tree: &mut Tree,
_tree: &mut Tree,
_layout: Layout<'_>,
_renderer: &crate::Renderer,
operation: &mut dyn iced_core::widget::Operation,
_operation: &mut dyn iced_core::widget::Operation,
) {
// TODO: double check operation handling
// let state = tree.state.downcast_mut::<State>();
@ -343,7 +345,7 @@ where
tree: &'b mut Tree,
layout: Layout<'b>,
renderer: &crate::Renderer,
viewport: &Rectangle,
_viewport: &Rectangle,
translation: Vector,
) -> Option<overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
@ -452,7 +454,7 @@ impl super::operation::Dropdown for State {
/// Computes the layout of a [`Dropdown`].
#[allow(clippy::too_many_arguments)]
pub fn layout(
renderer: &crate::Renderer,
_renderer: &crate::Renderer,
limits: &layout::Limits,
width: Length,
gap: f32,
@ -552,62 +554,63 @@ pub fn update<
selections: &[S],
state: impl FnOnce() -> &'a mut State,
_window_id: Option<window::Id>,
on_surface_action: Option<Arc<dyn Fn(surface::Action) -> Message + Send + Sync + 'static>>,
action_map: Option<Arc<dyn Fn(Message) -> AppMessage + Send + Sync + 'static>>,
icons: &[icon::Handle],
gap: f32,
padding: Padding,
text_size: Option<f32>,
font: Option<crate::font::Font>,
selected_option: Option<usize>,
_on_surface_action: Option<Arc<dyn Fn(surface::Action) -> Message + Send + Sync + 'static>>,
_action_map: Option<Arc<dyn Fn(Message) -> AppMessage + Send + Sync + 'static>>,
_icons: &[icon::Handle],
_gap: f32,
_padding: Padding,
_text_size: Option<f32>,
_font: Option<crate::font::Font>,
_selected_option: Option<usize>,
) {
let state = state();
let open = |shell: &mut Shell<'_, Message>,
state: &mut State,
on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>| {
state.is_open.store(true, Ordering::Relaxed);
let mut hovered_guard = state.hovered_option.lock().unwrap();
*hovered_guard = selected;
let id = window::Id::unique();
state.popup_id = id;
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
if let Some(((on_surface_action, parent), action_map)) = on_surface_action
.as_ref()
.zip(_window_id)
.zip(action_map.clone())
{
use iced_runtime::platform_specific::wayland::popup::{
SctkPopupSettings, SctkPositioner,
};
let bounds = layout.bounds();
let anchor_rect = Rectangle {
x: bounds.x as i32,
y: bounds.y as i32,
width: bounds.width as i32,
height: bounds.height as i32,
};
let icon_width = if icons.is_empty() { 0.0 } else { 24.0 };
let measure = |_label: &str, selection_paragraph: &crate::Paragraph| -> f32 {
selection_paragraph.min_width().round()
};
let pad_width = padding.x().mul_add(2.0, 16.0);
let open =
|_shell: &mut Shell<'_, Message>,
state: &mut State,
_on_selected: Arc<dyn Fn(usize) -> Message + Send + Sync + 'static>| {
state.is_open.store(true, Ordering::Relaxed);
let mut hovered_guard = state.hovered_option.lock().unwrap();
*hovered_guard = selected;
let id = window::Id::unique();
state.popup_id = id;
#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]
if let Some(((on_surface_action, parent), action_map)) = on_surface_action
.as_ref()
.zip(_window_id)
.zip(action_map.clone())
{
use iced_runtime::platform_specific::wayland::popup::{
SctkPopupSettings, SctkPositioner,
};
let bounds = layout.bounds();
let anchor_rect = Rectangle {
x: bounds.x as i32,
y: bounds.y as i32,
width: bounds.width as i32,
height: bounds.height as i32,
};
let icon_width = if icons.is_empty() { 0.0 } else { 24.0 };
let measure = |_label: &str, selection_paragraph: &crate::Paragraph| -> f32 {
selection_paragraph.min_width().round()
};
let pad_width = padding.x().mul_add(2.0, 16.0);
let selections_width = selections
.iter()
.zip(state.selections.iter_mut())
.map(|(label, selection)| measure(label.as_ref(), selection.raw()))
.fold(0.0, |next, current| current.max(next));
let selections_width = selections
.iter()
.zip(state.selections.iter_mut())
.map(|(label, selection)| measure(label.as_ref(), selection.raw()))
.fold(0.0, |next, current| current.max(next));
let icons: Cow<'static, [Handle]> = Cow::Owned(icons.to_vec());
let selections: Cow<'static, [S]> = Cow::Owned(selections.to_vec());
let state = state.clone();
let on_close = surface::action::destroy_popup(id);
let on_surface_action_clone = on_surface_action.clone();
let translation = layout.virtual_offset();
let get_popup_action = surface::action::simple_popup::<AppMessage>(
move || {
SctkPopupSettings {
let icons: Cow<'static, [Handle]> = Cow::Owned(icons.to_vec());
let selections: Cow<'static, [S]> = Cow::Owned(selections.to_vec());
let state = state.clone();
let on_close = surface::action::destroy_popup(id);
let on_surface_action_clone = on_surface_action.clone();
let translation = layout.virtual_offset();
let get_popup_action = surface::action::simple_popup::<AppMessage>(
move || {
SctkPopupSettings {
parent,
id,
input_zone: None,
@ -626,30 +629,30 @@ pub fn update<
grab: true,
close_with_children: true,
}
},
Some(Box::new(move || {
let action_map = action_map.clone();
let on_selected = on_selected.clone();
let e: Element<'static, crate::Action<AppMessage>> =
Element::from(menu_widget(
bounds,
&state,
gap,
padding,
text_size.unwrap_or(14.0),
selections.clone(),
icons.clone(),
selected_option,
Arc::new(move |i| on_selected.clone()(i)),
Some(on_surface_action_clone(on_close.clone())),
))
.map(move |m| crate::Action::App(action_map.clone()(m)));
e
})),
);
shell.publish(on_surface_action(get_popup_action));
}
};
},
Some(Box::new(move || {
let action_map = action_map.clone();
let on_selected = on_selected.clone();
let e: Element<'static, crate::Action<AppMessage>> =
Element::from(menu_widget(
bounds,
&state,
gap,
padding,
text_size.unwrap_or(14.0),
selections.clone(),
icons.clone(),
selected_option,
Arc::new(move |i| on_selected.clone()(i)),
Some(on_surface_action_clone(on_close.clone())),
))
.map(move |m| crate::Action::App(action_map.clone()(m)));
e
})),
);
shell.publish(on_surface_action(get_popup_action));
}
};
let is_open = state.is_open.load(Ordering::Relaxed);
let refresh = state.close_operation && state.open_operation;

View file

@ -3,7 +3,7 @@
use crate::{Element, Renderer};
use derive_setters::Setters;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::widget::{Operation, Tree};
use iced_core::{
Clipboard, Layout, Length, Padding, Rectangle, Shell, Vector, Widget, layout, mouse, overlay,

View file

@ -3,7 +3,7 @@
use crate::{Element, Renderer};
use derive_setters::Setters;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::widget::{Operation, Tree};
use iced_core::{
Alignment, Clipboard, Layout, Length, Padding, Rectangle, Shell, Vector, Widget, layout, mouse,

View file

@ -5,7 +5,7 @@
/// Icon bundling is not enabled on unix platforms.
#[cfg(unix)]
pub fn get(icon_name: &str) -> Option<super::Data> {
pub fn get(_icon_name: &str) -> Option<super::Data> {
None
}

View file

@ -1,4 +1,4 @@
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -1,7 +1,7 @@
use crate::Theme;
use cosmic_theme::LayeredTheme;
use iced::widget::Container;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -74,5 +74,5 @@ pub use menu_tree::{
pub use crate::style::menu_bar::{Appearance, StyleSheet};
pub(crate) use menu_bar::{menu_roots_children, menu_roots_diff};
pub(crate) use menu_inner::Menu;
pub use menu_inner::{CloseCondition, ItemHeight, ItemWidth, PathHighlight};
pub(crate) use menu_inner::{Direction, Menu, init_root_menu};

View file

@ -9,6 +9,7 @@ use super::{
},
menu_tree::MenuTree,
};
use crate::{Renderer, style::menu_bar::StyleSheet, widget::RcWrapper};
#[cfg(all(
feature = "multi-window",
feature = "wayland",
@ -16,18 +17,12 @@ use super::{
feature = "winit",
feature = "surface-message"
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
use crate::{
Renderer,
style::menu_bar::StyleSheet,
widget::{
RcWrapper,
dropdown::menu::{self, State},
menu::menu_inner::init_root_menu,
},
app::cosmic::{WINDOWING_SYSTEM, WindowingSystem},
menu::menu_inner::init_root_menu,
};
use iced::{Point, Shadow, Vector, event::Status, window};
use iced::{Point, Shadow, Vector, window};
use iced_core::Border;
use iced_widget::core::{
Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Widget, event,
@ -762,7 +757,7 @@ where
tree: &'b mut Tree,
layout: Layout<'b>,
_renderer: &Renderer,
viewport: &Rectangle,
_viewport: &Rectangle,
translation: Vector,
) -> Option<overlay::Element<'b, Message, crate::Theme, Renderer>> {
#[cfg(all(

View file

@ -559,10 +559,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
) -> Option<(usize, MenuState)> {
use event::{
Event::{Mouse, Touch},
Status::{Captured, Ignored},
};
use event::Event::{Mouse, Touch};
use mouse::{
Button::Left,
Event::{ButtonPressed, ButtonReleased, CursorMoved, WheelScrolled},
@ -582,7 +579,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
let viewport_size = viewport.size();
let overlay_offset = Point::ORIGIN - viewport.position();
let overlay_cursor = view_cursor.position().unwrap_or_default() - overlay_offset;
let menu_roots = match &mut self.menu_roots {
let _menu_roots = match &mut self.menu_roots {
Cow::Borrowed(_) => panic!(),
Cow::Owned(o) => o.as_mut_slice(),
};
@ -950,6 +947,7 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
Menu::draw(self, renderer, theme, style, layout, cursor);
}
#[allow(unused)]
#[allow(clippy::too_many_lines)]
fn update(
&mut self,
@ -1607,7 +1605,6 @@ fn process_scroll_events<Message>(
) where
Message: Clone,
{
use event::Status::{Captured, Ignored};
use mouse::ScrollDelta;
menu.tree.inner.with_data_mut(|state| {

View file

@ -4,7 +4,7 @@
//! A container which displays an overlay when a popup widget is attached.
use iced::widget;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -1,7 +1,7 @@
//! Create choices using radio buttons.
use crate::Theme;
use iced::border;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -5,7 +5,7 @@ use iced::futures::channel::mpsc::UnboundedSender;
use iced::widget::Container;
pub use subscription::*;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -1,7 +1,7 @@
//! Responsive Container, which will notify of size changes.
use iced::{Limits, Size};
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;

View file

@ -19,14 +19,18 @@ pub use super::value::Value;
use apply::Apply;
use iced::Limits;
use iced::clipboard::dnd::{DndAction, DndEvent, OfferEvent, SourceEvent};
use iced::clipboard::mime::AsMimeTypes;
use iced_core::event::{self, Event};
use iced::clipboard::dnd::DndAction;
#[cfg(all(feature = "wayland", target_os = "linux"))]
use iced::clipboard::{
dnd::{DndEvent, OfferEvent, SourceEvent},
mime::AsMimeTypes,
};
use iced_core::event::Event;
use iced_core::input_method::{self, InputMethod, Preedit};
use iced_core::mouse::{self, click};
use iced_core::overlay::Group;
use iced_core::renderer::{self, Renderer as CoreRenderer};
use iced_core::text::{self, Affinity, Paragraph, Renderer, Text};
use iced_core::text::{self, Paragraph, Renderer, Text};
use iced_core::time::{Duration, Instant};
use iced_core::touch;
use iced_core::widget::Id;
@ -829,7 +833,7 @@ where
&mut self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &crate::Renderer,
_renderer: &crate::Renderer,
operation: &mut dyn Operation,
) {
operation.container(Some(&self.id), layout.bounds());
@ -921,7 +925,7 @@ where
// Enable custom buttons defined on the trailing icon position to be handled.
if !self.is_editable_variant {
if let Some(trailing_layout) = trailing_icon_layout {
let res = trailing_icon.as_widget_mut().update(
let _res = trailing_icon.as_widget_mut().update(
tree,
event,
trailing_layout,
@ -1410,7 +1414,7 @@ pub fn layout<Message>(
#[allow(clippy::cast_lossless)]
#[allow(clippy::cast_possible_truncation)]
pub fn update<'a, Message: Clone + 'static>(
id: Option<Id>,
_id: Option<Id>,
event: &Event,
text_layout: Layout<'_>,
edit_button_layout: Option<Layout<'_>>,
@ -1435,7 +1439,7 @@ pub fn update<'a, Message: Clone + 'static>(
line_height: text::LineHeight,
layout: Layout<'_>,
manage_value: bool,
drag_threshold: f32,
_drag_threshold: f32,
always_active: bool,
) {
let update_cache = |state, value| {

View file

@ -6,7 +6,7 @@ use iced_core::layout::Node;
use iced_core::Element;
use iced_core::Overlay;
use iced_core::event::{self, Event};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;
@ -154,8 +154,6 @@ where
translation,
)
} else {
let bounds = layout.bounds();
Some(overlay::Element::new(Box::new(ToasterOverlay::new(
&mut state.children[1],
&mut self.toasts,

View file

@ -1,11 +1,11 @@
//! Show toggle controls using togglers.
use std::time::{Duration, Instant};
use std::time::Duration;
use crate::{Element, anim};
use iced_core::{
Border, Clipboard, Event, Layout, Length, Pixels, Rectangle, Shell, Size, Widget, alignment,
event, layout, mouse,
layout, mouse,
renderer::{self, Renderer},
text, touch,
widget::{self, Tree, tree},
@ -13,7 +13,7 @@ use iced_core::{
};
use iced_widget::{Id, toggler::Status};
pub use iced_widget::toggler::{Catalog, Style};
pub use iced_widget::toggler::Catalog;
pub fn toggler<'a, Message>(is_checked: bool) -> Toggler<'a, Message> {
Toggler::new(is_checked)
@ -249,7 +249,7 @@ impl<'a, Message> Widget<Message, crate::Theme, crate::Renderer> for Toggler<'a,
shell.capture_event();
}
}
Event::Window(window::Event::RedrawRequested(now)) => {
Event::Window(window::Event::RedrawRequested(_now)) => {
state.anim.anim_done(self.duration);
if state.anim.last_change.is_some() {
shell.request_redraw();

View file

@ -6,7 +6,7 @@ use std::{
};
use crate::Element;
use iced::{Length, Rectangle, Size, event};
use iced::{Length, Rectangle, Size};
use iced_core::{Widget, id::Id, widget, widget::tree};
#[derive(Debug)]