Fenix icon indicating copy to clipboard operation
Fenix copied to clipboard

Callback Improvements

Open Matthew-Whitlock opened this issue 5 months ago • 0 comments

Currently, you cannot remove a callback unless you are certain any callbacks added after it have been removed. There is no way to confirm this at runtime.

We should create a key type that can be used to reference a specific callback, and use it to construct a (sorted) std::map<fenix_callback_key_t, fenix_callback_t>. We can then return the callback key to the user when a callback is added, and allow that key to be used to remove a callback. This key should also be passed to the callback function itself, to allow a callback to remove itself.

To avoid changing the callback function signature in the future, callbacks should take a single struct parameter, e.g. fenix_callback_info_t, that has all of the arguments within it. This way we can pass new data to callbacks over time while remaining backwards compatible.

Matthew-Whitlock avatar Jul 09 '25 14:07 Matthew-Whitlock