diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 46 |
2 files changed, 24 insertions, 23 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 54e15a2604d..3048a49b3a6 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -646,6 +646,7 @@ void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); #define UI_TEXT_MARGIN_X 0.4f +#define UI_POPUP_MARGIN (UI_DPI_FAC * 12) /* interface_style.c */ void uiStyleInit(void); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index d863845f3ad..8fc8816aa33 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -668,18 +668,18 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* widget rect, in region coords */ { - int width = UI_ThemeMenuShadowWidth(); + const int margin = UI_POPUP_MARGIN; - data->bbox.xmin = width; - data->bbox.xmax = BLI_rcti_size_x(&rect_i) - width; - data->bbox.ymin = width; + data->bbox.xmin = margin; + data->bbox.xmax = BLI_rcti_size_x(&rect_i) - margin; + data->bbox.ymin = margin; data->bbox.ymax = BLI_rcti_size_y(&rect_i); /* region bigger for shadow */ - ar->winrct.xmin = rect_i.xmin - width; - ar->winrct.xmax = rect_i.xmax + width; - ar->winrct.ymin = rect_i.ymin - width; - ar->winrct.ymax = rect_i.ymax + width; + ar->winrct.xmin = rect_i.xmin - margin; + ar->winrct.xmax = rect_i.xmax + margin; + ar->winrct.ymin = rect_i.ymin - margin; + ar->winrct.ymax = rect_i.ymax + margin; } /* adds subwindow */ @@ -1166,15 +1166,15 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) /* compute position */ if (but->block->flag & UI_BLOCK_SEARCH_MENU) { - int width = UI_ThemeMenuShadowWidth(); + const int margin = UI_POPUP_MARGIN; /* this case is search menu inside other menu */ /* we copy region size */ ar->winrct = butregion->winrct; /* widget rect, in region coords */ - data->bbox.xmin = width; - data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - width; + data->bbox.xmin = margin; + data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - margin; /* Do not use shadow width for height, gives insane margin with big shadows, and issue T41548 with small ones */ data->bbox.ymin = 8 * UI_DPI_FAC; data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - 8 * UI_DPI_FAC; @@ -1189,7 +1189,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) } else { const int searchbox_width = uiSearchBoxWidth(); - const int shadow_width = UI_ThemeMenuShadowWidth(); + const int margin = UI_POPUP_MARGIN; rect_fl.xmin = but->rect.xmin - 5; /* align text with button */ rect_fl.xmax = but->rect.xmax + 5; /* symmetrical */ @@ -1244,15 +1244,15 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) } /* widget rect, in region coords */ - data->bbox.xmin = shadow_width; - data->bbox.xmax = BLI_rcti_size_x(&rect_i) + shadow_width; - data->bbox.ymin = shadow_width; - data->bbox.ymax = BLI_rcti_size_y(&rect_i) + shadow_width; + data->bbox.xmin = margin; + data->bbox.xmax = BLI_rcti_size_x(&rect_i) + margin; + data->bbox.ymin = margin; + data->bbox.ymax = BLI_rcti_size_y(&rect_i) + margin; /* region bigger for shadow */ - ar->winrct.xmin = rect_i.xmin - shadow_width; - ar->winrct.xmax = rect_i.xmax + shadow_width; - ar->winrct.ymin = rect_i.ymin - shadow_width; + ar->winrct.xmin = rect_i.xmin - margin; + ar->winrct.xmax = rect_i.xmax + margin; + ar->winrct.ymin = rect_i.ymin - margin; ar->winrct.ymax = rect_i.ymax; } @@ -1642,7 +1642,7 @@ uiBlock *ui_popup_block_refresh( bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, uiBut *but) { - const int width = UI_ThemeMenuShadowWidth(); + const int margin = UI_POPUP_MARGIN; wmWindow *window = CTX_wm_window(C); ARegion *ar = handle->region; @@ -1769,9 +1769,9 @@ uiBlock *ui_popup_block_refresh( /* the block and buttons were positioned in window space as in 2.4x, now * these menu blocks are regions so we bring it back to region space. * additionally we add some padding for the menu shadow or rounded menus */ - ar->winrct.xmin = block->rect.xmin - width; - ar->winrct.xmax = block->rect.xmax + width; - ar->winrct.ymin = block->rect.ymin - width; + ar->winrct.xmin = block->rect.xmin - margin; + ar->winrct.xmax = block->rect.xmax + margin; + ar->winrct.ymin = block->rect.ymin - margin; ar->winrct.ymax = block->rect.ymax + MENU_TOP; ui_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin); |