From 7cb4f727618445c6743a4a11026123bd95a5813a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 23 Jan 2022 09:39:24 +0100 Subject: [PATCH] LVGL fix argument to remove_cb --- .../lv_berry/generate/be_lv_c_mapping.h | 4 ++-- lib/libesp32_lvgl/lv_berry/tools/convert.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/libesp32_lvgl/lv_berry/generate/be_lv_c_mapping.h b/lib/libesp32_lvgl/lv_berry/generate/be_lv_c_mapping.h index 8dbb4bd71..2da03074c 100644 --- a/lib/libesp32_lvgl/lv_berry/generate/be_lv_c_mapping.h +++ b/lib/libesp32_lvgl/lv_berry/generate/be_lv_c_mapping.h @@ -369,8 +369,8 @@ const be_ntv_func_def_t lv_obj_func[] = { { "refresh_ext_draw_size", (void*) &lv_obj_refresh_ext_draw_size, "", "(lv.lv_obj)" }, { "refresh_self_size", (void*) &lv_obj_refresh_self_size, "b", "(lv.lv_obj)" }, { "refresh_style", (void*) &lv_obj_refresh_style, "", "(lv.lv_obj)i(lv.lv_style_prop)" }, - { "remove_event_cb", (void*) &lv_obj_remove_event_cb, "b", "(lv.lv_obj)^lv_event_cb^" }, - { "remove_event_cb_with_user_data", (void*) &lv_obj_remove_event_cb_with_user_data, "b", "(lv.lv_obj)^lv_event_cb^." }, + { "remove_event_cb", (void*) &lv_obj_remove_event_cb, "b", "(lv.lv_obj)." }, + { "remove_event_cb_with_user_data", (void*) &lv_obj_remove_event_cb_with_user_data, "b", "(lv.lv_obj).." }, { "remove_event_dsc", (void*) &lv_obj_remove_event_dsc, "b", "(lv.lv_obj)i" }, { "remove_local_style_prop", (void*) &lv_obj_remove_local_style_prop, "b", "(lv.lv_obj)(lv.lv_style_prop)i" }, { "remove_style", (void*) &lv_obj_remove_style, "", "(lv.lv_obj)(lv.lv_style)i" }, diff --git a/lib/libesp32_lvgl/lv_berry/tools/convert.py b/lib/libesp32_lvgl/lv_berry/tools/convert.py index b09df0750..1b6ff1149 100644 --- a/lib/libesp32_lvgl/lv_berry/tools/convert.py +++ b/lib/libesp32_lvgl/lv_berry/tools/convert.py @@ -238,6 +238,7 @@ with open(lv_widgets_file) as f: c_args = "" args_raw = [ x.strip(" \t\n\r") for x in g.group(3).split(",") ] # split by comma and strip # print(args_raw) + func_name = g.group(2) for arg_raw in args_raw: # Ex: 'const lv_obj_t * parent' -> 'const ', 'lv_obj_t', ' * ', 'parent', '' # Ex: 'bool auto_fit' -> '', 'bool', ' ', 'auto_fit', '' @@ -264,10 +265,13 @@ with open(lv_widgets_file) as f: c_args += ga_type else: if ga_type.endswith("_cb"): - # it's a callback type, we encode it differently - if ga_type not in lv_cb_types: - lv_cb_types.append(ga_type) - c_args += "^" + ga_type + "^" + if 'remove_' in func_name: # if the call is to remove the cb, just treat as an 'anything' parameter + c_args += "." + else: + # it's a callback type, we encode it differently + if ga_type not in lv_cb_types: + lv_cb_types.append(ga_type) + c_args += "^" + ga_type + "^" else: # we have a high-level type that we treat as a class name, enclose in parenthesis c_args += "(" + "lv." + ga_type + ")" @@ -276,7 +280,6 @@ with open(lv_widgets_file) as f: c_args += "[......]" # allow 6 additional parameters # analyze function name and determine if it needs to be assigned to a specific class - func_name = g.group(2) # Ex: func_name -> 'lv_obj_set_parent' if func_name.startswith("_"): continue # skip low-level if func_name.startswith("lv_debug_"): continue # skip debug