layout: Split out static data

This will make it possible later to cache this data or compare for best size selection without hassle.
This commit is contained in:
Dorota Czaplejewicz
2022-09-30 17:42:00 +00:00
parent c017a773ea
commit 649f67d319
4 changed files with 136 additions and 130 deletions

View File

@ -192,7 +192,7 @@ fn iter_layout_sources(
}
fn load_layout_data(source: DataSource)
-> Result<::layout::LayoutData, LoadError>
-> Result<::layout::LayoutParseData, LoadError>
{
let handler = logging::Print {};
match source {
@ -217,7 +217,7 @@ fn load_layout_data_with_fallback(
kind: ArrangementKind,
purpose: ContentPurpose,
overlay: Option<&str>,
) -> (ArrangementKind, layout::LayoutData) {
) -> (ArrangementKind, layout::LayoutParseData) {
// Build the path to the right keyboard layout subdirectory
let path = env::var_os("SQUEEKBOARD_KEYBOARDSDIR")

View File

@ -157,7 +157,7 @@ impl Layout {
}
pub fn build<H: logging::Handler>(self, mut warning_handler: H)
-> (Result<::layout::LayoutData, FormattingError>, H)
-> (Result<::layout::LayoutParseData, FormattingError>, H)
{
let button_names = self.views.values()
.flat_map(|rows| {
@ -279,7 +279,7 @@ impl Layout {
};
(
Ok(::layout::LayoutData {
Ok(layout::LayoutParseData {
views: views,
keymaps: keymaps.into_iter().map(|keymap_str|
CString::new(keymap_str)