XuNeo / luavgl

lua + lvgl = luavgl An optimized lvgl Lua binding
MIT License
57 stars 13 forks source link

event: simplify event processing via lv_array module #10

Closed XuNeo closed 4 months ago

XuNeo commented 4 months ago

Introduce the problem

LVGL currently doesn't support return an event handler so it can be removed later. The only solution is comparing all event dsc user_data.

The issue can be solved by simply storing the event dsc pointer to lvgl internal array and return it to user.

For lua, it needs to remember which events are added from lua side, so when obj is cleaned up, those events can be removed separately with native added events.

Proposal

Use dsc pointer in lvgl internal array, and use lv_array to store events added from lua.