diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-16 14:14:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-16 14:14:26 +0300 |
commit | 59bc71d69b138db12c9017c7a7d492fdb6dcddc3 (patch) | |
tree | 76843fbd74a77f31c8a66a20a32de7b613c48416 /source/blender/editors/interface/interface_region_menu_popup.c | |
parent | 73fb445b8dbe88b1ac8e12acd2515618f9e64ac0 (diff) |
Fix popups opening in the wrong direction over headers
Checks for header alignment didn't account for tool-header & header
having different alignment.
There is no reason to use a lookup function on the area
(ED_area_header_alignment) as we already have region.
Check the regions alignment directly, remove access functions.
Diffstat (limited to 'source/blender/editors/interface/interface_region_menu_popup.c')
-rw-r--r-- | source/blender/editors/interface/interface_region_menu_popup.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 077e8888d53..dbb072fa4a6 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -284,17 +284,10 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi else { /* for a header menu we set the direction automatic */ if (!pup->slideout && flip) { - ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - if (area && region) { - if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(area)) == RGN_ALIGN_BOTTOM) { - UI_block_direction_set(block, UI_DIR_UP); - UI_block_order_flip(block); - } - } - if (region->regiontype == RGN_TYPE_FOOTER) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) { + if (region) { + if (RGN_TYPE_IS_HEADER_ANY(region->regiontype)) { + if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); } |