use qualia::{SurfaceId, AestheticsConfig, AestheticsCoordinationTrait, OutputInfo};
use cursor::Cursor;
use background::Background;
use panels::PanelManager;
pub struct Aesthetics<'a, C>
where C: AestheticsCoordinationTrait
{
cursor: Cursor<C>,
background: Background<C>,
panels: PanelManager<'a, C>,
coordinator: C,
}
impl<'a, C> Aesthetics<'a, C>
where C: AestheticsCoordinationTrait + Clone
{
pub fn new(coordinator: C, config: AestheticsConfig) -> Self {
Aesthetics {
cursor: Cursor::new(coordinator.clone()),
background: Background::new(coordinator.clone(), config.clone()),
panels: PanelManager::new(coordinator.get_workspace_state(), coordinator.clone()),
coordinator: coordinator,
}
}
}
impl<'a, C> Aesthetics<'a, C>
where C: AestheticsCoordinationTrait + Clone
{
pub fn on_cursor_surface_change(&mut self, sid: SurfaceId) {
self.cursor.on_surface_change(sid);
}
pub fn on_background_surface_change(&mut self, sid: SurfaceId) {
self.background.on_surface_change(sid);
}
pub fn on_pointer_focus_changed(&mut self, old_pfsid: SurfaceId, new_pfsid: SurfaceId) {
self.cursor.on_focus_changed(old_pfsid, new_pfsid);
}
pub fn on_surface_destroyed(&mut self, sid: SurfaceId) {
self.cursor.on_surface_destroyed(sid);
}
pub fn on_display_created(&mut self, output: &OutputInfo) {
self.cursor.on_display_created();
self.background.on_display_created();
self.panels.create_new_panel(output);
}
pub fn on_workspace_state_changed(&mut self) {
self.panels.update_workspace_state(self.coordinator.get_workspace_state())
}
pub fn on_timer_500(&mut self) {
self.panels.redraw_all();
}
}