fix [#30087] operator_context is different for popup and submenu's *TODO, after 2.62*
having context different for menu vs submenu is quite confusing, now they are both: WM_OP_INVOKE_REGION_WIN this changes WM_menu_invoke behavior.
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
@@ -2510,6 +2511,9 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
|
||||
pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
|
||||
pup->block->puphash = ui_popup_menu_hash(title);
|
||||
pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
|
||||
|
||||
/* note, this intentionally differs from the menu & submenu default because many operators
|
||||
* use popups like this to select one of their options - where having invoke doesn't make sense */
|
||||
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
|
||||
|
||||
/* create in advance so we can let buttons point to retval already */
|
||||
@@ -2721,6 +2725,10 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
|
||||
menu.layout = layout;
|
||||
menu.type = mt;
|
||||
|
||||
if (G.debug & G_DEBUG_WM) {
|
||||
printf("%s: opening menu \"%s\"\n", __func__, idname);
|
||||
}
|
||||
|
||||
mt->draw(C, &menu);
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
Reference in New Issue
Block a user