chore: update libcosmic

This commit is contained in:
Ashley Wulber 2024-02-06 12:01:22 -05:00 committed by GitHub
parent bb30ba29d7
commit 6906964142
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 345 additions and 331 deletions

554
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@ resolver = "2"
[workspace.dependencies.libcosmic]
git = "https://github.com/pop-os/libcosmic"
features = ["single-instance", "tokio", "wayland", "xdg-portal"]
features = ["single-instance", "tokio", "wayland", "xdg-portal", "wgpu"]
[workspace.dependencies.cosmic-config]
git = "https://github.com/pop-os/libcosmic"
@ -15,7 +15,6 @@ git = "https://github.com/pop-os/cosmic-bg"
[workspace.dependencies.cosmic-comp-config]
git = "https://github.com/pop-os/cosmic-comp"
# path = "../cosmic-comp/cosmic-comp-config"
[workspace.dependencies.cosmic-panel-config]
git = "https://github.com/pop-os/cosmic-panel"
@ -30,3 +29,8 @@ rev = "2e9bf9f"
[profile.release]
opt-level = 3
[patch.crates-io]
wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "faed98b" }

View file

@ -51,4 +51,6 @@ version = "0.14.1"
features = ["fluent-system", "desktop-requester"]
[features]
default = ["wgpu"]
wgpu = ["libcosmic/wgpu"]
test = []

View file

@ -4,8 +4,8 @@
use cosmic::iced_core::renderer::Quad;
use cosmic::iced_core::widget::{tree, Tree};
use cosmic::iced_core::{
self as core, Clipboard, Element, Layout, Length, Rectangle, Renderer as IcedRenderer, Shell,
Size, Widget,
self as core, Border, Clipboard, Element, Layout, Length, Rectangle, Renderer as IcedRenderer,
Shell, Size, Widget,
};
use cosmic::iced_core::{alignment, event, text};
use cosmic::iced_core::{layout, mouse, renderer, touch, Point};
@ -63,7 +63,7 @@ impl<'a, Message> Arrangement<'a, Message> {
}
}
impl<'a, Message: Clone> Widget<Message, Renderer> for Arrangement<'a, Message> {
impl<'a, Message: Clone> Widget<Message, cosmic::Theme, Renderer> for Arrangement<'a, Message> {
fn tag(&self) -> tree::Tag {
tree::Tag::of::<State>()
}
@ -72,12 +72,11 @@ impl<'a, Message: Clone> Widget<Message, Renderer> for Arrangement<'a, Message>
tree::State::new(State::default())
}
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
self.height
fn size(&self) -> Size<Length> {
Size {
width: self.width,
height: self.height,
}
}
fn layout(
@ -129,7 +128,7 @@ impl<'a, Message: Clone> Widget<Message, Renderer> for Arrangement<'a, Message>
.width(Length::Fixed(width))
.height(Length::Fixed(height));
let size = limits.resolve(Size::ZERO);
let size = limits.resolve(width, height, Size::ZERO);
layout::Node::new(size)
}
@ -289,9 +288,12 @@ impl<'a, Message: Clone> Widget<Message, Renderer> for Arrangement<'a, Message>
renderer.fill_quad(
Quad {
bounds: region,
border_radius: 4.0.into(),
border_width: 3.0,
border_color: border_color.into(),
border: Border {
color: border_color.into(),
radius: 4.0.into(),
width: 3.0,
},
shadow: Default::default(),
},
core::Background::Color(background.into()),
);
@ -306,9 +308,11 @@ impl<'a, Message: Clone> Widget<Message, Renderer> for Arrangement<'a, Message>
renderer.fill_quad(
Quad {
bounds: id_bounds,
border_radius: 30.0.into(),
border_width: 0.0,
border_color: core::Color::TRANSPARENT,
border: Border {
radius: 30.0.into(),
..Default::default()
},
shadow: Default::default(),
},
core::Background::Color(cosmic_theme.palette.neutral_1.into()),
);

View file

@ -201,6 +201,7 @@ impl Page {
error!("No panel config helper. Failed to save applets.");
return;
};
dbg!("writing applet config");
if let Err(e) = config.write_entry(helper) {
error!("Failed to save applets: {:?}", e);
}
@ -765,10 +766,10 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.padding(8)
.style(theme::Container::Custom(Box::new(move |theme| {
let mut style = theme.appearance(&theme::Container::Primary);
style.border_radius = 8.0.into();
style.border.radius = 8.0.into();
if is_dragged {
style.border_color = theme.cosmic().accent_color().into();
style.border_width = 2.0;
style.border.color = theme.cosmic().accent_color().into();
style.border.width = 2.0;
}
style
})))
@ -798,9 +799,9 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.padding(8)
.style(theme::Container::Custom(Box::new(move |theme| {
let mut style = theme.appearance(&theme::Container::Primary);
style.border_radius = 8.0.into();
style.border_color = theme.cosmic().bg_divider().into();
style.border_width = 2.0;
style.border.radius = 8.0.into();
style.border.color = theme.cosmic().bg_divider().into();
style.border.width = 2.0;
style.background = Some(Color::TRANSPARENT.into());
style
})))
@ -855,7 +856,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.padding(8)
.style(theme::Container::Custom(Box::new(move |theme| {
let mut style = theme.appearance(&theme::Container::Primary);
style.border_radius = 8.0.into();
style.border.radius = 8.0.into();
style
})))
.into()
@ -931,7 +932,8 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
}
}
impl<'a, Message: 'static> Widget<Message, cosmic::Renderer> for AppletReorderList<'a, Message>
impl<'a, Message: 'static> Widget<Message, cosmic::Theme, cosmic::Renderer>
for AppletReorderList<'a, Message>
where
Message: Clone,
{
@ -951,12 +953,8 @@ where
tree.diff_children(&mut [&mut self.inner]);
}
fn width(&self) -> Length {
Length::Fill
}
fn height(&self) -> Length {
Length::Shrink
fn size(&self) -> Size<Length> {
Size::new(Length::Fill, Length::Shrink)
}
fn layout(
@ -1475,7 +1473,7 @@ where
tree: &'b mut Tree,
layout: layout::Layout<'_>,
renderer: &cosmic::Renderer,
) -> Option<overlay::Element<'b, Message, cosmic::Renderer>> {
) -> Option<overlay::Element<'b, Message, cosmic::Theme, cosmic::Renderer>> {
self.inner.as_widget_mut().overlay(
&mut tree.children[0],
layout.children().next().unwrap(),

View file

@ -416,6 +416,7 @@ impl PageInner {
Message::OutputAdded(name, output) => {
self.outputs.push(name.clone());
self.outputs_map.insert(output.id(), (name, output));
return;
}
Message::OutputRemoved(output) => {
if let Some((name, _)) = self.outputs_map.remove(&output.id()) {
@ -436,6 +437,8 @@ impl PageInner {
panel_config.border_radius = 0;
}
dbg!("writing config");
_ = panel_config.write_entry(helper);
}
}

View file

@ -2,6 +2,8 @@
// SPDX-License-Identifier: GPL-3.0-only
use super::Message;
use cosmic::iced::Radius;
use cosmic::iced_core::Border;
use cosmic::iced_core::{self, gradient::Linear, Background, Color, Degrees, Length};
use cosmic::iced_runtime::core::image::Handle as ImageHandle;
use cosmic::prelude::*;
@ -68,11 +70,15 @@ pub fn color_image<'a, M: 'a>(
Background::Gradient(iced_core::Gradient::Linear(linear))
}
}),
border_radius: border_radius
.map(|br| br.into())
.unwrap_or_else(|| theme.cosmic().corner_radii.radius_s.into()),
border_width: 0.0,
border_color: Color::TRANSPARENT,
border: Border {
radius: border_radius.map_or_else(
|| Radius::from(theme.cosmic().corner_radii.radius_s),
|br| br.into(),
),
..Default::default()
},
shadow: Default::default(),
}
}))
.padding(0)

View file

@ -5,6 +5,7 @@ use cosmic::{
widget::{self, horizontal_space},
window, Length,
},
iced_core::Border,
iced_style, theme,
widget::{button, container, icon, radio, settings},
};
@ -98,9 +99,11 @@ fn popover_menu() -> cosmic::Element<'static, Message> {
icon_color: Some(theme.cosmic().background.on.into()),
text_color: Some(theme.cosmic().background.on.into()),
background: Some(iced::Color::from(theme.cosmic().background.base).into()),
border_radius: cosmic.corner_radii.radius_m.into(),
border_width: 0.0,
border_color: iced::Color::TRANSPARENT,
border: Border {
radius: cosmic.corner_radii.radius_m.into(),
..Default::default()
},
shadow: Default::default(),
}
}))
.into()

View file

@ -1,7 +1,7 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::theme;
use cosmic::{iced_core::Border, theme};
#[must_use]
pub fn display_container_frame() -> cosmic::theme::Container {
@ -11,9 +11,12 @@ pub fn display_container_frame() -> cosmic::theme::Container {
icon_color: None,
text_color: None,
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::WHITE)),
border_color: cosmic::iced::Color::WHITE,
border_radius: cosmic.corner_radii.radius_xs.into(),
border_width: 3.0,
border: Border {
color: cosmic::iced::Color::WHITE,
radius: cosmic.corner_radii.radius_xs.into(),
width: 3.0,
},
shadow: Default::default(),
}
})
}
@ -26,9 +29,12 @@ pub fn display_container_screen() -> cosmic::theme::Container {
icon_color: None,
text_color: None,
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::BLACK)),
border_color: cosmic::iced::Color::BLACK,
border_radius: cosmic.corner_radii.radius_0.into(),
border_width: 0.0,
border: Border {
color: cosmic::iced::Color::BLACK,
radius: cosmic.corner_radii.radius_0.into(),
width: 0.0,
},
shadow: Default::default(),
}
})
}