fix(color): lvgl.clear() not working correctly for Lua child layouts (#6030)
This commit is contained in:
@@ -321,14 +321,18 @@ void LvglWidgetObjectBase::parseParam(lua_State *L, const char *key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LvglWidgetObjectBase::clear()
|
||||||
|
{
|
||||||
|
clearRequest = true;
|
||||||
|
if (getWindow())
|
||||||
|
getWindow()->clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool LvglWidgetObjectBase::callRefs(lua_State *L)
|
bool LvglWidgetObjectBase::callRefs(lua_State *L)
|
||||||
{
|
{
|
||||||
if (clearRequest) {
|
if (clearRequest) {
|
||||||
clearRequest = false;
|
clearRequest = false;
|
||||||
if (getWindow()) {
|
clearChildRefs(L);
|
||||||
getWindow()->clear();
|
|
||||||
clearChildRefs(L);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,6 +356,11 @@ bool LvglWidgetObjectBase::callRefs(lua_State *L)
|
|||||||
auto p = LvglWidgetObjectBase::checkLvgl(L, -1);
|
auto p = LvglWidgetObjectBase::checkLvgl(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
if (p) if (!p->callRefs(L)) return false;
|
if (p) if (!p->callRefs(L)) return false;
|
||||||
|
if (clearRequest) {
|
||||||
|
clearRequest = false;
|
||||||
|
clearChildRefs(L);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class LvglWidgetObjectBase
|
|||||||
|
|
||||||
static LvglWidgetObjectBase *checkLvgl(lua_State *L, int index);
|
static LvglWidgetObjectBase *checkLvgl(lua_State *L, int index);
|
||||||
|
|
||||||
void clear() { clearRequest = true; }
|
void clear();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int luaRef = LUA_REFNIL;
|
int luaRef = LUA_REFNIL;
|
||||||
|
|||||||
Reference in New Issue
Block a user