diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2024-03-28 05:36:38 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-03-28 05:36:38 +0000 |
| commit | 0175eaf1b5e79c53ac86adc568b67f018a5a7daf (patch) | |
| tree | d6b380746fb011c46c1c1aa2946005c6971a9c4e /lib | |
| parent | 35a822fe602cdc9e3a3482df3913ea33af6fc8c2 (diff) | |
| parent | 7c5dae84175aa750ca1b8beeb066f5607ca73181 (diff) | |
| download | tangara-fw-0175eaf1b5e79c53ac86adc568b67f018a5a7daf.tar.gz | |
Merge pull request 'themes' (#58) from themes into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/58
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/luavgl/src/luavgl.h | 5 | ||||
| -rw-r--r-- | lib/luavgl/src/util.c | 11 | ||||
| -rw-r--r-- | lib/lvgl/src/misc/lv_style.c | 8 |
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/luavgl/src/luavgl.h b/lib/luavgl/src/luavgl.h index b26bb5c7..c76a6493 100644 --- a/lib/luavgl/src/luavgl.h +++ b/lib/luavgl/src/luavgl.h @@ -158,6 +158,11 @@ LUALIB_API int luavgl_obj_getuserdatauv(lua_State *L, int idx); LUALIB_API lv_obj_t *luavgl_to_obj(lua_State *L, int idx); /** + * @brief Get lvgl style from stack + */ +LUALIB_API lv_style_t *luavgl_to_style(lua_State *L, int idx); + +/** * @brief Convert value to integer * * Supported values are: integer, float, boolean diff --git a/lib/luavgl/src/util.c b/lib/luavgl/src/util.c index 2042a6d9..7fb86906 100644 --- a/lib/luavgl/src/util.c +++ b/lib/luavgl/src/util.c @@ -272,6 +272,17 @@ LUALIB_API lv_obj_t *luavgl_to_obj(lua_State *L, int idx) return lobj->obj; } +LUALIB_API lv_style_t *luavgl_to_style(lua_State *L, int idx) +{ + luavgl_style_t *lsty = luavgl_check_style(L, idx); + if (lsty == NULL) { + luaL_argerror(L, idx, "expect lua lvgl style, got null"); + return NULL; + } + + return &lsty->style; +} + LUALIB_API int luavgl_tointeger(lua_State *L, int idx) { int v = 0; diff --git a/lib/lvgl/src/misc/lv_style.c b/lib/lvgl/src/misc/lv_style.c index 419c29e4..baf135ad 100644 --- a/lib/lvgl/src/misc/lv_style.c +++ b/lib/lvgl/src/misc/lv_style.c @@ -92,9 +92,11 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR [LV_STYLE_SHADOW_COLOR] = 0, [LV_STYLE_SHADOW_OPA] = LV_STYLE_PROP_EXT_DRAW, - [LV_STYLE_IMG_OPA] = 0, - [LV_STYLE_IMG_RECOLOR] = 0, - [LV_STYLE_IMG_RECOLOR_OPA] = 0, + // Image style inheritance + // https://github.com/lvgl/lvgl/pull/4664 + [LV_STYLE_IMG_OPA] = LV_STYLE_PROP_INHERIT, + [LV_STYLE_IMG_RECOLOR] = LV_STYLE_PROP_INHERIT, + [LV_STYLE_IMG_RECOLOR_OPA] = LV_STYLE_PROP_INHERIT, [LV_STYLE_LINE_WIDTH] = LV_STYLE_PROP_EXT_DRAW, [LV_STYLE_LINE_DASH_WIDTH] = 0, |
