|
@@ -23,12 +23,14 @@
|
|
|
/* -------------------------------------------------------------------------
|
|
/* -------------------------------------------------------------------------
|
|
|
* Label widget native function wrappers
|
|
* Label widget native function wrappers
|
|
|
* -------------------------------------------------------------------------*/
|
|
* -------------------------------------------------------------------------*/
|
|
|
-static int32 _cb_create(lv_obj_t *par, lv_obj_t *copy)
|
|
|
|
|
|
|
+static int32
|
|
|
|
|
+_cb_create(lv_obj_t *par, lv_obj_t *copy)
|
|
|
{
|
|
{
|
|
|
return wgl_native_wigdet_create(WIDGET_TYPE_CB, par, copy);
|
|
return wgl_native_wigdet_create(WIDGET_TYPE_CB, par, copy);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static int32 _cb_get_text_length(lv_obj_t *cb)
|
|
|
|
|
|
|
+static int32
|
|
|
|
|
+_cb_get_text_length(lv_obj_t *cb)
|
|
|
{
|
|
{
|
|
|
const char *text = lv_cb_get_text(cb);
|
|
const char *text = lv_cb_get_text(cb);
|
|
|
|
|
|
|
@@ -38,9 +40,9 @@ static int32 _cb_get_text_length(lv_obj_t *cb)
|
|
|
return strlen(text);
|
|
return strlen(text);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static int32 _cb_get_text(lv_obj_t *cb, char *buffer, int buffer_len)
|
|
|
|
|
|
|
+static char *
|
|
|
|
|
+_cb_get_text(lv_obj_t *cb, char *buffer, int buffer_len)
|
|
|
{
|
|
{
|
|
|
- wasm_module_inst_t module_inst = get_module_inst();
|
|
|
|
|
const char *text = lv_cb_get_text(cb);
|
|
const char *text = lv_cb_get_text(cb);
|
|
|
|
|
|
|
|
if (text == NULL)
|
|
if (text == NULL)
|
|
@@ -49,7 +51,7 @@ static int32 _cb_get_text(lv_obj_t *cb, char *buffer, int buffer_len)
|
|
|
strncpy(buffer, text, buffer_len - 1);
|
|
strncpy(buffer, text, buffer_len - 1);
|
|
|
buffer[buffer_len - 1] = '\0';
|
|
buffer[buffer_len - 1] = '\0';
|
|
|
|
|
|
|
|
- return addr_native_to_app(buffer);
|
|
|
|
|
|
|
+ return buffer;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static WGLNativeFuncDef cb_native_func_defs[] = {
|
|
static WGLNativeFuncDef cb_native_func_defs[] = {
|
|
@@ -57,7 +59,7 @@ static WGLNativeFuncDef cb_native_func_defs[] = {
|
|
|
{ CB_FUNC_ID_SET_TEXT, lv_cb_set_text, NO_RET, 2, {0, -1}, {1, -1} },
|
|
{ CB_FUNC_ID_SET_TEXT, lv_cb_set_text, NO_RET, 2, {0, -1}, {1, -1} },
|
|
|
{ CB_FUNC_ID_SET_STATIC_TEXT, lv_cb_set_static_text, NO_RET, 2, {0, -1}, {1, -1} },
|
|
{ CB_FUNC_ID_SET_STATIC_TEXT, lv_cb_set_static_text, NO_RET, 2, {0, -1}, {1, -1} },
|
|
|
{ CB_FUNC_ID_GET_TEXT_LENGTH, _cb_get_text_length, HAS_RET, 1, {0, -1}, {-1} },
|
|
{ CB_FUNC_ID_GET_TEXT_LENGTH, _cb_get_text_length, HAS_RET, 1, {0, -1}, {-1} },
|
|
|
- { CB_FUNC_ID_GET_TEXT, _cb_get_text, HAS_RET, 3, {0, -1}, {1, -1} },
|
|
|
|
|
|
|
+ { CB_FUNC_ID_GET_TEXT, _cb_get_text, RET_PTR, 3, {0, -1}, {1, -1} },
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/*************** Native Interface to Wasm App ***********/
|
|
/*************** Native Interface to Wasm App ***********/
|
|
@@ -67,7 +69,8 @@ wasm_cb_native_call(wasm_module_inst_t module_inst,
|
|
|
{
|
|
{
|
|
|
uint32 size = sizeof(cb_native_func_defs) / sizeof(WGLNativeFuncDef);
|
|
uint32 size = sizeof(cb_native_func_defs) / sizeof(WGLNativeFuncDef);
|
|
|
|
|
|
|
|
- wgl_native_func_call(cb_native_func_defs,
|
|
|
|
|
|
|
+ wgl_native_func_call(module_inst,
|
|
|
|
|
+ cb_native_func_defs,
|
|
|
size,
|
|
size,
|
|
|
func_id,
|
|
func_id,
|
|
|
argv_offset,
|
|
argv_offset,
|