update libcosmic

This commit is contained in:
Ashley Wulber 2025-03-05 23:08:56 -05:00 committed by Jeremy Soller
parent 4b0e73fca4
commit b84ee1827c
3 changed files with 493 additions and 572 deletions

View file

@ -1,8 +1,8 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::app::{message, Core, Settings, Task};
use cosmic::surface_message::{MessageWrapper, SurfaceMessage};
use cosmic::app::{Action, Core, Settings, Task};
use cosmic::surface;
use cosmic::{
executor,
iced::{
@ -207,21 +207,6 @@ pub struct Flags {
wallpapers: Vec<(String, cosmic_bg_config::Source)>,
}
impl From<Message> for MessageWrapper<Message> {
fn from(value: Message) -> Self {
match value {
Message::Surface(msg) => MessageWrapper::Surface(msg),
msg => MessageWrapper::Message(msg),
}
}
}
impl From<SurfaceMessage> for Message {
fn from(value: SurfaceMessage) -> Self {
Message::Surface(value)
}
}
/// Messages that are used specifically by our [`App`].
#[derive(Clone, Debug)]
pub enum Message {
@ -235,7 +220,7 @@ pub enum Message {
PowerInfo(Option<(String, f64)>),
Prompt(String, bool, Option<String>),
Submit,
Surface(SurfaceMessage),
Surface(surface::Action),
Suspend,
Error(String),
Lock,
@ -543,10 +528,10 @@ impl cosmic::Application for App {
#[cfg(feature = "logind")]
return cosmic::task::future(async move {
match crate::logind::suspend().await {
Ok(()) => message::none(),
Ok(()) => cosmic::action::none(),
Err(err) => {
log::error!("failed to suspend: {:?}", err);
message::app(Message::Error(err.to_string()))
cosmic::Action::App(Message::Error(err.to_string()))
}
}
});
@ -611,7 +596,11 @@ impl cosmic::Application for App {
}
}
}
Message::Surface(_) => {}
Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
}
Task::none()
}