use smallvec::SmallVec;
use slate_platform::WindowId;
use crate::types::ElementId;
use super::state::AppState;
mod ime;
mod key;
mod mouse;
mod text_input;
impl AppState {
pub(super) fn build_focused_chain(&self, window_id: WindowId) -> SmallVec<[ElementId; 8]> {
let mut chain: SmallVec<[ElementId; 8]> = SmallVec::new();
let guard = self.windows.borrow();
let Some(win) = guard.get(&window_id) else {
return chain;
};
let Some(start) = win.focus_registry.borrow().focused() else {
return chain;
};
let parent_map = win.parent_map.borrow();
let mut cur = Some(start);
while let Some(id) = cur {
chain.push(id);
cur = parent_map.get(&id).copied();
}
chain
}
}