UI: add check for any kind of popup

Fixes T56155 when merging into 2.8
This commit is contained in:
Campbell Barton 2018-07-31 10:37:46 +10:00
parent 885cc4cf9a
commit 1195a4a040
Notes: blender-bot 2023-02-14 05:30:27 +01:00
Referenced by issue #56155, Right Click Option for Header available in Pop Overs
3 changed files with 10 additions and 1 deletions

View File

@ -533,7 +533,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
/* Show header tools for header buttons. */
if (ui_block_is_menu(but->block) == false) {
if (ui_block_is_popup_any(but->block) == false) {
ARegion *ar = CTX_wm_region(C);
if (ar && (ar->regiontype == RGN_TYPE_HEADER)) {
uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);

View File

@ -752,6 +752,7 @@ bool ui_but_is_toggle(const uiBut *but);
extern bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
extern bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
extern bool ui_block_is_popup_any(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
/* interface_context_menu.c */
bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but);

View File

@ -86,6 +86,14 @@ bool ui_block_is_pie_menu(const uiBlock *block)
return ((block->flag & UI_BLOCK_RADIAL) != 0);
}
bool ui_block_is_popup_any(const uiBlock *block)
{
return (
ui_block_is_menu(block) ||
ui_block_is_pie_menu(block)
);
}
bool UI_block_is_empty(const uiBlock *block)
{
for (const uiBut *but = block->buttons.first; but; but = but->next) {