fix(dock): msg conversion using provided function

This commit is contained in:
Ashley Wulber 2025-03-17 17:02:32 -04:00 committed by Ashley Wulber
parent 96954a217a
commit ccbf883ff0
4 changed files with 9 additions and 22 deletions

View file

@ -17,7 +17,6 @@ use slotmap::SlotMap;
pub mod magnifier;
mod wayland;
use tokio::task::spawn_blocking;
pub use wayland::{AccessibilityEvent, AccessibilityRequest};
#[derive(Debug, Default)]

View file

@ -94,7 +94,7 @@ pub trait PanelPage {
pub(crate) fn behavior_and_position<
P: page::Page<crate::pages::Message> + PanelPage,
T: Fn(Message) -> crate::pages::Message + Copy + 'static,
T: Fn(Message) -> crate::pages::Message + Copy + Send + Sync + 'static,
>(
p: &P,
msg_map: T,
@ -128,11 +128,7 @@ pub(crate) fn behavior_and_position<
Message::PanelAnchor,
cosmic::iced::window::Id::RESERVED,
Message::Surface,
|a| {
crate::app::Message::PageMessage(crate::pages::Message::Panel(
super::Message(a),
))
},
move |a| crate::app::Message::PageMessage(msg_map(a)),
),
))
.add(settings::item(
@ -147,11 +143,7 @@ pub(crate) fn behavior_and_position<
Message::Output,
cosmic::iced::window::Id::RESERVED,
Message::Surface,
|a| {
crate::app::Message::PageMessage(crate::pages::Message::Panel(
super::Message(a),
))
},
move |a| crate::app::Message::PageMessage(msg_map(a)),
),
))
.apply(Element::from)
@ -161,7 +153,7 @@ pub(crate) fn behavior_and_position<
pub(crate) fn style<
P: page::Page<crate::pages::Message> + PanelPage,
T: Fn(Message) -> crate::pages::Message + Copy + 'static,
T: Fn(Message) -> crate::pages::Message + Copy + Send + Sync + 'static,
>(
p: &P,
msg_map: T,
@ -206,11 +198,7 @@ pub(crate) fn style<
Message::Appearance,
cosmic::iced::window::Id::RESERVED,
Message::Surface,
|a| {
crate::app::Message::PageMessage(crate::pages::Message::Panel(
super::Message(a),
))
},
move |a| crate::app::Message::PageMessage(msg_map(a)),
),
))
.add(settings::flex_item(
@ -592,7 +580,7 @@ impl PageInner {
return Task::none();
}
Message::ResetPanel | Message::FullReset => {}
Message::Surface(a) => {
Message::Surface(_) => {
unimplemented!()
}
}

View file

@ -5,7 +5,7 @@ use cosmic::{
iced::Length,
surface,
widget::{self, settings, toggler},
Apply, Element, Task,
Apply, Element,
};
use cosmic_config::{ConfigGet, ConfigSet};

View file

@ -615,7 +615,7 @@ fn input() -> Section<crate::pages::Message> {
widget::slider(0..=150, page.source_volume, Message::SourceVolumeChanged)
.breakpoints(&[100]),
);
let mut devices = widget::dropdown::popup_dropdown(
let devices = widget::dropdown::popup_dropdown(
&page.sources,
Some(page.active_source.unwrap_or(0)),
Message::SourceChanged,
@ -633,7 +633,7 @@ fn input() -> Section<crate::pages::Message> {
.add(settings::item(&*section.descriptions[device], devices));
if !page.source_profiles.is_empty() {
let mut dropdown = widget::dropdown::popup_dropdown(
let dropdown = widget::dropdown::popup_dropdown(
&page.source_profiles,
page.active_source_profile,
Message::SourceProfileChanged,