diff options
4 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c7a2e46cecb..c23124de586 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3539,8 +3539,18 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, if((/*inside &&*/ !menu->menuretval && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) { but= ui_but_find_activated(ar); - if(but) + if(but) { + ScrArea *ctx_area= CTX_wm_area(C); + ARegion *ctx_region= CTX_wm_region(C); + + if(menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area); + if(menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region); + retval= ui_handle_button_event(C, event, but); + + if(menu->ctx_area) CTX_wm_area_set(C, ctx_area); + if(menu->ctx_region) CTX_wm_region_set(C, ctx_region); + } else retval= ui_handle_button_over(C, event, ar); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 07c8ad04c6f..4f3b211c9de 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -284,6 +284,8 @@ struct uiPopupBlockHandle { /* for operator popups */ const char *opname; int opcontext; + ScrArea *ctx_area; + ARegion *ctx_region; /* return values */ int butretval; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index eadb3f9b2aa..4dd5dd76637 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -635,6 +635,10 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut /* create handle */ handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle"); + /* store context for operator */ + handle->ctx_area= CTX_wm_area(C); + handle->ctx_region= CTX_wm_region(C); + /* create area region */ ar= ui_add_temporary_region(CTX_wm_screen(C)); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 028c0105f11..cfb4e2220a4 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1457,12 +1457,13 @@ static int redo_last_exec(bContext *C, wmOperator *op) static void redo_last_cb(bContext *C, void *arg1, void *arg2) { -#if 0 - /* XXX context here is not correct .. we get the popup block region - * context but should actually have where ever the last operator was - * executed. */ - WM_operator_name_call(C, "SCREEN_OT_redo_last", WM_OP_EXEC_DEFAULT, NULL); -#endif + wmOperator *lastop= CTX_wm_manager(C)->operators.last; + + if(lastop) { + ED_undo_pop(C); + WM_operator_repeat(C, lastop); + } + } static uiBlock *ui_block_create_redo_last(bContext *C, ARegion *ar, void *arg_op) |