chore: update to the latest libcosmic

This commit is contained in:
Hojjat 2026-04-08 13:10:59 -06:00 committed by Jacob Kauffmann
parent 9547da2b25
commit b17f8889a8
7 changed files with 98 additions and 77 deletions

View file

@ -1,6 +1,8 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
use cosmic::iced::platform_specific::shell::wayland::commands::overlap_notify::overlap_notify;
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
use cosmic::iced::{
Limits, Point,
@ -12,8 +14,6 @@ use cosmic::iced::{
Anchor, KeyboardInteractivity, Layer, destroy_layer_surface, get_layer_surface,
},
};
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
use cosmic::iced_winit::commands::overlap_notify::overlap_notify;
use cosmic::{
Application, ApplicationExt, Element,
app::{self, Core, Task, context_drawer},
@ -21,6 +21,9 @@ use cosmic::{
cosmic_theme,
desktop::fde::DesktopEntry,
executor,
iced::core::widget::operation::focusable::unfocus,
iced::runtime::{clipboard, task},
iced::widget::{button::focus, scrollable::AbsoluteOffset},
iced::{
self, Alignment, Event, Length, Rectangle, Size, Subscription,
clipboard::dnd::DndAction,
@ -32,9 +35,6 @@ use cosmic::{
widget::scrollable,
window::{self, Event as WindowEvent, Id as WindowId},
},
iced_core::widget::operation::focusable::unfocus,
iced_runtime::{clipboard, task},
iced_widget::{button::focus, scrollable::AbsoluteOffset},
style, surface, theme,
widget::{
self,
@ -1253,31 +1253,28 @@ impl App {
.insert(id, (operation.clone(), controller.clone()));
// Use a task to send operations to the compio runtime thread.
cosmic::Task::stream(cosmic::iced_futures::stream::channel(
4,
move |msg_tx| async move {
let (tx, rx) = tokio::sync::oneshot::channel();
cosmic::Task::stream(cosmic::iced::stream::channel(4, move |msg_tx| async move {
let (tx, rx) = tokio::sync::oneshot::channel();
let msg_tx = Arc::new(tokio::sync::Mutex::new(msg_tx));
let msg_tx = Arc::new(tokio::sync::Mutex::new(msg_tx));
let msg_tx_clone = msg_tx.clone();
let msg_tx_clone = msg_tx.clone();
_ = compio_tx
.send(Box::pin(async move {
let msg = match operation.perform(&msg_tx_clone, controller).await {
Ok(result_paths) => Message::PendingComplete(id, result_paths),
Err(err) => Message::PendingError(id, err),
};
_ = compio_tx
.send(Box::pin(async move {
let msg = match operation.perform(&msg_tx_clone, controller).await {
Ok(result_paths) => Message::PendingComplete(id, result_paths),
Err(err) => Message::PendingError(id, err),
};
_ = tx.send(msg);
}))
.await;
_ = tx.send(msg);
}))
.await;
if let Ok(msg) = rx.await {
let _ = msg_tx.lock().await.send(msg).await;
}
},
))
if let Ok(msg) = rx.await {
let _ = msg_tx.lock().await.send(msg).await;
}
}))
.map(cosmic::Action::App)
}
@ -2054,7 +2051,8 @@ impl App {
let progress = controller.progress();
section = section.add(widget::column::with_children([
widget::row::with_children([
widget::progress_bar(0.0..=1.0, progress)
widget::determinate_linear(progress)
.width(Length::Fill)
.girth(progress_bar_height)
.into(),
if controller.is_paused() {
@ -4431,7 +4429,7 @@ impl Application for App {
use cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{
Anchor, Gravity,
};
use cosmic::iced_runtime::platform_specific::wayland::popup::{
use cosmic::iced::runtime::platform_specific::wayland::popup::{
SctkPopupSettings, SctkPositioner,
};
let window_id = WindowId::unique();
@ -6178,8 +6176,9 @@ impl Application for App {
//TODO: get height from theme?
let progress_bar_height = Length::Fixed(4.0);
let progress_bar =
widget::progress_bar(0.0..=1.0, total_progress).girth(progress_bar_height);
let progress_bar = widget::determinate_linear(total_progress)
.width(Length::Fill)
.girth(progress_bar_height);
let container = widget::layer_container(widget::column::with_children([
widget::row::with_children([

View file

@ -5,6 +5,9 @@ use cosmic::{
Application, ApplicationExt, Element,
app::{Core, Task, context_drawer, cosmic::Cosmic},
cosmic_config, cosmic_theme, executor,
iced::core::widget::operation,
iced::platform_specific::shell::{self as iced_winit, SurfaceIdWrapper},
iced::widget::scrollable::AbsoluteOffset,
iced::{
self, Alignment, Event, Length, Size, Subscription,
core::SmolStr,
@ -15,9 +18,6 @@ use cosmic::{
widget::scrollable,
window,
},
iced_core::widget::operation,
iced_widget::scrollable::AbsoluteOffset,
iced_winit::{self, SurfaceIdWrapper},
theme,
widget::{
self, Operation,
@ -203,7 +203,7 @@ impl<T: AsRef<str>> From<T> for DialogLabel {
impl<'a, M: Clone + 'static> From<&'a DialogLabel> for Element<'a, M> {
fn from(label: &'a DialogLabel) -> Self {
let mut iced_spans: Vec<cosmic::iced_core::text::Span<'_, ()>> =
let mut iced_spans: Vec<cosmic::iced::core::text::Span<'_, ()>> =
Vec::with_capacity(label.spans.len());
for span in &label.spans {
iced_spans.push(cosmic::iced::widget::span(&span.text).underline(span.underline));
@ -1791,7 +1791,7 @@ impl Application for App {
use cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{
Anchor, Gravity,
};
use cosmic::iced_runtime::platform_specific::wayland::popup::{
use cosmic::iced::runtime::platform_specific::wayland::popup::{
SctkPopupSettings, SctkPositioner,
};
use cosmic::iced::Rectangle;

View file

@ -1,6 +1,6 @@
use cosmic::{
iced::core::keyboard::key::Named,
iced::keyboard::Key,
iced_core::keyboard::key::Named,
widget::menu::key_bind::{KeyBind, Modifier},
};
use std::collections::HashMap;

View file

@ -1,4 +1,4 @@
use cosmic::{iced_core, iced_widget};
use cosmic::iced::{core as iced_core, widget as iced_widget};
use iced_core::event::Event;
use iced_core::layout;
use iced_core::mouse;

View file

@ -5,7 +5,7 @@ use std::time::Instant;
use crate::tab::DOUBLE_CLICK_DURATION;
use cosmic::{
Element, Renderer, Theme,
iced_core::{
iced::core::{
Clipboard, Color, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget,
border::Border,
event::Event,
@ -488,7 +488,7 @@ where
state: &Tree,
layout: Layout<'_>,
renderer: &Renderer,
dnd_rectangles: &mut cosmic::iced_core::clipboard::DndDestinationRectangles,
dnd_rectangles: &mut cosmic::iced::core::clipboard::DndDestinationRectangles,
) {
self.content.as_widget().drag_destinations(
&state.children[0],

View file

@ -2,6 +2,7 @@ use cosmic::{
Apply, Element, cosmic_theme,
desktop::fde::{DesktopEntry, get_languages_from_env},
font,
iced::core::{mouse::ScrollDelta, widget::tree},
iced::{
Alignment, Border, Color, ContentFit, Length, Point, Rectangle, Size, Subscription, Vector,
advanced::{
@ -20,7 +21,6 @@ use cosmic::{
},
window,
},
iced_core::{mouse::ScrollDelta, widget::tree},
theme,
widget::{
self, DndDestination, DndSource, Id, RcElementWrapper, Widget,
@ -6244,7 +6244,7 @@ impl Tab {
tab_view = tab_view.style(|t| {
let mut a = widget::container::Style::default();
let c = t.cosmic();
a.border = cosmic::iced_core::Border {
a.border = cosmic::iced::core::Border {
color: (c.accent_color()).into(),
width: 1.,
radius: c.radius_0().into(),
@ -6992,7 +6992,7 @@ pub fn respond_to_scroll_direction(delta: ScrollDelta, modifiers: &Modifiers) ->
fn text_editor_class(
theme: &cosmic::Theme,
status: cosmic::widget::text_editor::Status,
) -> cosmic::iced_widget::text_editor::Style {
) -> cosmic::iced::widget::text_editor::Style {
let cosmic = theme.cosmic();
let container = theme.current_container();
@ -7005,9 +7005,9 @@ fn text_editor_class(
let placeholder = placeholder.into();
match status {
cosmic::iced_widget::text_editor::Status::Active
| cosmic::iced_widget::text_editor::Status::Disabled => {
cosmic::iced_widget::text_editor::Style {
cosmic::iced::widget::text_editor::Status::Active
| cosmic::iced::widget::text_editor::Status::Disabled => {
cosmic::iced::widget::text_editor::Style {
background: background.into(),
border: cosmic::iced::Border {
radius: cosmic.corner_radii.radius_m.into(),
@ -7019,9 +7019,9 @@ fn text_editor_class(
selection,
}
}
cosmic::iced_widget::text_editor::Status::Hovered
| cosmic::iced_widget::text_editor::Status::Focused { .. } => {
cosmic::iced_widget::text_editor::Style {
cosmic::iced::widget::text_editor::Status::Hovered
| cosmic::iced::widget::text_editor::Status::Focused { .. } => {
cosmic::iced::widget::text_editor::Style {
background: background.into(),
border: cosmic::iced::Border {
radius: cosmic.corner_radii.radius_m.into(),
@ -7040,7 +7040,7 @@ fn text_editor_class(
mod tests {
use std::{fs, io, path::PathBuf};
use cosmic::{iced::mouse::ScrollDelta, iced_runtime::keyboard::Modifiers, widget};
use cosmic::{iced::mouse::ScrollDelta, iced::runtime::keyboard::Modifiers, widget};
use log::{debug, trace};
use tempfile::TempDir;
use test_log::test;