diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-07 14:35:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-07 14:38:08 +0300 |
commit | b9491476e5c11b789b8ecaad87a2b2de4c09a60a (patch) | |
tree | 4016eb59c2772a59651e907414a4327dbef660d8 /source/blender | |
parent | 8d1e3594fea9596eceaf4a14606d281c133d8c9d (diff) |
Cleanup: remove unused operator arguments to UI_popup_block_invoke_ex
Add optional can_refresh argument, useful to prevent text field
from exiting on refresh.
Diffstat (limited to 'source/blender')
4 files changed, 8 insertions, 17 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f4dd2da06fc..9eb3bda76e2 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -621,8 +621,7 @@ void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, void (*arg_free)(void *arg), - const char *opname, - int opcontext); + bool can_refresh); void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 84be109b38e..18ffb2fd614 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -10764,9 +10764,6 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) if (temp.popup_func) { temp.popup_func(C, temp.popup_arg, temp.retvalue); } - if (temp.optype) { - WM_operator_name_call_ptr(C, temp.optype, temp.opcontext, NULL); - } } else if (temp.cancel_func) { temp.cancel_func(C, temp.popup_arg); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c97af78e967..e42bbdfdba5 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -597,10 +597,8 @@ struct uiPopupBlockHandle { /* for operator popups */ struct wmOperator *popup_op; - struct wmOperatorType *optype; ScrArea *ctx_area; ARegion *ctx_region; - int opcontext; /* return values */ int butretval; diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 31ef7261eb3..3e34b7f3f8a 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -581,21 +581,18 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports) /** \name Popup Block API * \{ */ -void UI_popup_block_invoke_ex(bContext *C, - uiBlockCreateFunc func, - void *arg, - void (*arg_free)(void *arg), - const char *opname, - int opcontext) +void UI_popup_block_invoke_ex( + bContext *C, uiBlockCreateFunc func, void *arg, void (*arg_free)(void *arg), bool can_refresh) { wmWindow *window = CTX_wm_window(C); uiPopupBlockHandle *handle; handle = ui_popup_block_create(C, NULL, NULL, func, NULL, arg, arg_free); handle->popup = true; - handle->can_refresh = true; - handle->optype = (opname) ? WM_operatortype_find(opname, 0) : NULL; - handle->opcontext = opcontext; + + /* It can be useful to disable refresh (even though it will work) + * as this exists text fields which can be disruptive if refresh isn't needed. */ + handle->can_refresh = can_refresh; UI_popup_handlers_add(C, &window->modalhandlers, handle, 0); UI_block_active_only_flagged_buttons(C, handle->region, handle->region->uiblocks.first); @@ -607,7 +604,7 @@ void UI_popup_block_invoke(bContext *C, void *arg, void (*arg_free)(void *arg)) { - UI_popup_block_invoke_ex(C, func, arg, arg_free, NULL, WM_OP_INVOKE_DEFAULT); + UI_popup_block_invoke_ex(C, func, arg, arg_free, true); } void UI_popup_block_ex(bContext *C, |