diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-30 18:27:54 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-30 18:46:59 +0300 |
commit | 17a67bf778b87d0d24adfac3bd89bc8d3300c741 (patch) | |
tree | 8eded550236046978c8fa93c498a50b0e6ccad08 /source/blender/editors/interface/interface_region_menu_popup.c | |
parent | ca12d70af0ff4397ed1ce9b5d7d1adadb06e569c (diff) |
UI: custom free function improvements
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits:
* The caller can pass `null` to indicate that the value should not be freed.
* Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible).
I added `uiFreeArgFunc` and used it in other places where appropriate.
Differential Revision: https://developer.blender.org/D11738
Diffstat (limited to 'source/blender/editors/interface/interface_region_menu_popup.c')
-rw-r--r-- | source/blender/editors/interface/interface_region_menu_popup.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 58a74a3473e..6e60ca79aaf 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -591,7 +591,7 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports) * \{ */ void UI_popup_block_invoke_ex( - bContext *C, uiBlockCreateFunc func, void *arg, void (*arg_free)(void *arg), bool can_refresh) + bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free, bool can_refresh) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *handle; @@ -608,10 +608,7 @@ void UI_popup_block_invoke_ex( WM_event_add_mousemove(window); } -void UI_popup_block_invoke(bContext *C, - uiBlockCreateFunc func, - void *arg, - void (*arg_free)(void *arg)) +void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free) { UI_popup_block_invoke_ex(C, func, arg, arg_free, true); } |