diff options
Diffstat (limited to 'source/blender/editors/interface/interface_region_popover.c')
-rw-r--r-- | source/blender/editors/interface/interface_region_popover.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 2042c15ed96..0ad7e570e80 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -46,13 +46,13 @@ #include "BLI_listbase.h" +#include "BLI_math_vector.h" #include "BLI_rect.h" #include "BLI_utildefines.h" -#include "BLI_math_vector.h" #include "BKE_context.h" -#include "BKE_screen.h" #include "BKE_report.h" +#include "BKE_screen.h" #include "ED_screen.h" @@ -94,7 +94,7 @@ static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext) { BLI_assert(pup->ui_size_x != 0); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS); UI_block_flag_enable(pup->block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER); @@ -104,15 +104,8 @@ static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext) } #endif - pup->layout = UI_block_layout(pup->block, - UI_LAYOUT_VERTICAL, - UI_LAYOUT_PANEL, - 0, - 0, - pup->ui_size_x, - 0, - UI_MENU_PADDING, - style); + pup->layout = UI_block_layout( + pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, pup->ui_size_x, 0, 0, style); uiLayoutSetOperatorContext(pup->layout, opcontext); @@ -178,23 +171,23 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v } if (!slideout) { - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ScrArea *area = CTX_wm_area(C); + ARegion *region = CTX_wm_region(C); - if (ar && ar->panels.first) { + if (region && region->panels.first) { /* For regions with panels, prefer to open to top so we can * see the values of the buttons below changing. */ UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } /* Prefer popover from header to be positioned into the editor. */ - else if (sa && ar) { - if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) { + else 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_DIR_CENTER_X); } } - if (ar->regiontype == RGN_TYPE_FOOTER) { - if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) { + if (region->regiontype == RGN_TYPE_FOOTER) { + if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(area)) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } } @@ -291,7 +284,7 @@ uiPopupBlockHandle *ui_popover_panel_create( * add a modal handler and pass on events. */ if (!but) { UI_popup_handlers_add(C, &window->modalhandlers, handle, 0); - WM_event_add_mousemove(C); + WM_event_add_mousemove(window); handle->popup = true; } @@ -410,7 +403,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) /* Add handlers. */ UI_popup_handlers_add(C, &window->modalhandlers, handle, 0); - WM_event_add_mousemove(C); + WM_event_add_mousemove(window); handle->popup = true; /* Re-add so it gets priority. */ |