config: Add and propagate appearance_config

This commit is contained in:
Victoria Brekenfeld 2025-12-08 18:21:58 +01:00 committed by Victoria Brekenfeld
parent 94d49210e6
commit 2adebb5fe1
10 changed files with 213 additions and 40 deletions

View file

@ -4,6 +4,7 @@ use crate::{
utils::{iced::IcedElementInternal, prelude::*},
};
use calloop::LoopHandle;
use cosmic_comp_config::AppearanceConfig;
use id_tree::NodeId;
use smithay::{
backend::{
@ -500,13 +501,14 @@ impl CosmicMapped {
&mut self,
(output, overlap): (&Output, Rectangle<i32, Logical>),
theme: cosmic::Theme,
appearance: AppearanceConfig,
) {
if let CosmicMappedInternal::Window(window) = &self.element {
let surface = window.surface();
let activated = surface.is_activated(true);
let handle = window.loop_handle();
let stack = CosmicStack::new(std::iter::once(surface), handle, theme);
let stack = CosmicStack::new(std::iter::once(surface), handle, theme, appearance);
if let Some(geo) = *self.last_geometry.lock().unwrap() {
stack.set_geometry(geo.to_global(output));
}
@ -524,11 +526,12 @@ impl CosmicMapped {
surface: CosmicSurface,
(output, overlap): (&Output, Rectangle<i32, Logical>),
theme: cosmic::Theme,
appearance: AppearanceConfig,
) {
let handle = self.loop_handle();
surface.try_force_undecorated(false);
surface.set_tiled(false);
let window = CosmicWindow::new(surface, handle, theme);
let window = CosmicWindow::new(surface, handle, theme, appearance);
if let Some(geo) = *self.last_geometry.lock().unwrap() {
window.set_geometry(geo.to_global(output));
@ -810,6 +813,14 @@ impl CosmicMapped {
}
}
pub(crate) fn update_appearance_conf(&self, appearance: &AppearanceConfig) {
match &self.element {
CosmicMappedInternal::Window(w) => w.update_appearance_conf(appearance),
CosmicMappedInternal::Stack(s) => s.update_appearance_conf(appearance),
CosmicMappedInternal::_GenericCatcher(_) => {}
}
}
pub(crate) fn force_redraw(&self) {
match &self.element {
CosmicMappedInternal::Window(w) => w.force_redraw(),