1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-12 15:24:14 +03:00

lvgui: BaseWindow add function to correctly dispos of objects

This is because objects *may* be added to the focus group. When added to
the focus group, they need to be removed before deleting.
This commit is contained in:
Samuel Dionne-Riel 2021-08-17 19:23:59 -04:00
parent aae84d77ee
commit ad65abb12a

View File

@ -50,6 +50,14 @@ module LVGUI
LVGUI.focus_group.add_obj(obj)
end
# Call instead of `#del` for objects added to the focus group.
# Totally unergonomic, but a workaround to the issue where `#del`
# frees the object, but we don't get notified.
def dispose_focusable_object(obj)
@focus_group.delete(obj)
obj.del
end
# Re-build the focus group from the elements on the window.
def reset_focus_group()
# Clear the focus group