From bd01bf3845fd67dc4e03f56d044b3bc53245eeed Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 12 Jun 2024 16:29:31 +1000 Subject: WIP bump luavgl to latest --- lib/luavgl/src/luavgl.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'lib/luavgl/src/luavgl.h') diff --git a/lib/luavgl/src/luavgl.h b/lib/luavgl/src/luavgl.h index c76a6493..d485cdc8 100644 --- a/lib/luavgl/src/luavgl.h +++ b/lib/luavgl/src/luavgl.h @@ -14,7 +14,7 @@ extern "C" { typedef const lv_font_t *(*make_font_cb)(const char *name, int size, int weight); -typedef void (*delete_font_cb)(lv_font_t *); +typedef void (*delete_font_cb)(const lv_font_t *); typedef int (*luavgl_pcall_t)(lua_State *L, int nargs, int nresults); typedef struct { @@ -48,13 +48,17 @@ typedef struct { }; } luavgl_value_setter_t; +struct event_callback_s { + lua_State *L; + int ref; /* ref to callback */ + lv_event_code_t code; + lv_event_dsc_t *dsc; +}; + typedef struct luavgl_obj_s { lv_obj_t *obj; /* NULL means obj deleted, but not gc'ed in lua */ bool lua_created; /* this object is created from lua */ - - /* internally used variables */ - int n_events; - struct event_callback_s *events; + lv_array_t events; /* events added from lua, need it to distinguish between lua */ } luavgl_obj_t; #define luavgl_obj_newmetatable(L, clz, name, l) \ @@ -123,6 +127,11 @@ LUALIB_API luavgl_obj_t *luavgl_add_lobj(lua_State *L, lv_obj_t *obj); */ LUALIB_API luavgl_obj_t *luavgl_to_lobj(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 Create metatable for specified object class * @@ -157,11 +166,6 @@ 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 * -- cgit v1.2.3