improv: remove double coloring of content_container windows
This sets the main content and the header bar to transparent when `content_container` is true, so that things aren't colored twice and overlayed on top of each other. This ensures that modifying color alpha behaves as expected, especially for frosted glass.
This commit is contained in:
parent
9fcd449611
commit
b71a7c9edf
3 changed files with 13 additions and 2 deletions
|
|
@ -689,7 +689,6 @@ impl<App: Application> ApplicationExt for App {
|
|||
.apply(container)
|
||||
.width(iced::Length::Fill)
|
||||
.height(iced::Length::Fill)
|
||||
.class(crate::theme::Container::WindowBackground)
|
||||
.apply(|w| id_container(w, iced_core::id::Id::new("COSMIC_content_container")))
|
||||
.into()
|
||||
} else {
|
||||
|
|
@ -713,6 +712,7 @@ impl<App: Application> ApplicationExt for App {
|
|||
.focused(focused)
|
||||
.maximized(maximized)
|
||||
.sharp_corners(sharp_corners)
|
||||
.transparent(content_container)
|
||||
.title(&core.window.header_title)
|
||||
.on_drag(crate::Action::Cosmic(Action::Drag))
|
||||
.on_right_click(crate::Action::Cosmic(Action::ShowWindowMenu))
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ pub enum Container<'a> {
|
|||
HeaderBar {
|
||||
focused: bool,
|
||||
sharp_corners: bool,
|
||||
transparent: bool,
|
||||
},
|
||||
List,
|
||||
Primary,
|
||||
|
|
@ -511,6 +512,7 @@ impl iced_container::Catalog for Theme {
|
|||
Container::HeaderBar {
|
||||
focused,
|
||||
sharp_corners,
|
||||
transparent,
|
||||
} => {
|
||||
let (icon_color, text_color) = if *focused {
|
||||
(
|
||||
|
|
@ -527,7 +529,11 @@ impl iced_container::Catalog for Theme {
|
|||
iced_container::Style {
|
||||
icon_color: Some(icon_color),
|
||||
text_color: Some(text_color),
|
||||
background: Some(iced::Background::Color(cosmic.background.base.into())),
|
||||
background: if *transparent {
|
||||
None
|
||||
} else {
|
||||
Some(iced::Background::Color(cosmic.background.base.into()))
|
||||
},
|
||||
border: Border {
|
||||
radius: [
|
||||
if *sharp_corners {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ pub fn header_bar<'a, Message>() -> HeaderBar<'a, Message> {
|
|||
is_ssd: false,
|
||||
on_double_click: None,
|
||||
is_condensed: false,
|
||||
transparent: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +93,9 @@ pub struct HeaderBar<'a, Message> {
|
|||
|
||||
/// Whether the headerbar should be compact
|
||||
is_condensed: bool,
|
||||
|
||||
/// Whether the headerbar should be transparent
|
||||
transparent: bool,
|
||||
}
|
||||
|
||||
impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
||||
|
|
@ -412,6 +416,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
|||
.class(crate::theme::Container::HeaderBar {
|
||||
focused: self.focused,
|
||||
sharp_corners: self.sharp_corners,
|
||||
transparent: self.transparent,
|
||||
})
|
||||
.center_y(Length::Shrink)
|
||||
.apply(widget::mouse_area);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue