1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-12 15:24:14 +03:00

lvgui: Use Fonts helpers to provide fonts

This decouples the actually-in-use assets from the native parts of
LVGUI.
This commit is contained in:
Samuel Dionne-Riel 2021-06-13 17:30:36 -04:00
parent 29ce88d750
commit 14e78352c1
3 changed files with 9 additions and 5 deletions

View File

@ -66,7 +66,7 @@ module LVGL::FFI
extern "lv_theme_t * lv_theme_get_night(void)"
# lvgl/src/lv_themes/lv_theme_nixos.h
extern "lv_theme_t * lv_theme_nixos_init(lv_font_t *)"
extern "lv_theme_t * lv_theme_nixos_init(lv_font_t *, lv_font_t *)"
extern "lv_theme_t * lv_theme_get_nixos(void)"
# lvgl/src/lv_core/lv_obj.h

View File

@ -77,9 +77,9 @@ module LVGL::Hacks
)
end
def self.theme_nixos()
def self.theme_nixos(font = 0, button_font = 0)
LVGL::FFI.lv_theme_set_current(
LVGL::FFI.lv_theme_nixos_init(0)
LVGL::FFI.lv_theme_nixos_init(font, button_font)
)
end

View File

@ -101,8 +101,12 @@ module LVGUI
# Start the animation core
LVGL::FFI.lv_anim_core_init()
# And switch to the desired theme
LVGL::Hacks.send(:"theme_#{theme}")
if theme == :nixos then
LVGL::Hacks.theme_nixos(LVGUI::Fonts.primary(), LVGUI::Fonts.secondary())
else
# And switch to the desired theme
LVGL::Hacks.send(:"theme_#{theme}")
end
end
# Runs the app, black boxes LVGL things.