feat: theme integration

refactor: only apply updates if there is a change in the theme

refactor: include theme in state

cleanup: theme integration
This commit is contained in:
Ashley Wulber 2023-10-10 13:55:34 -04:00 committed by Victoria Brekenfeld
parent c16b86d1bf
commit abbe94e6e1
24 changed files with 409 additions and 139 deletions

View file

@ -114,6 +114,7 @@ impl CosmicWindow {
pub fn new(
window: impl Into<CosmicSurface>,
handle: LoopHandle<'static, crate::state::State>,
theme: cosmic::Theme,
) -> CosmicWindow {
let window = window.into();
let width = window.geometry().size.w;
@ -129,6 +130,7 @@ impl CosmicWindow {
},
(width, SSD_HEIGHT),
handle,
theme,
))
}
@ -213,6 +215,14 @@ impl CosmicWindow {
popup_elements.into_iter().map(C::from).collect(),
)
}
pub(crate) fn set_theme(&self, theme: cosmic::Theme) {
self.0.set_theme(theme);
}
pub(crate) fn force_redraw(&self) {
self.0.force_redraw();
}
}
#[derive(Debug, Clone, Copy)]