diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-10-18 20:31:55 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-10-18 20:31:55 +0300 |
commit | bdad412fa76e6f4035f0a49c0b224de659ebbc25 (patch) | |
tree | dc1b4cfdcac91b06bed4562714d46e0ed59166f5 /source/blender/editors | |
parent | 78a5895c967e17b21e2a0a36309dad7f47bf928e (diff) |
Fix for T81400: Block Width Corrections
Scale widths of popovers and dialogs with Text Style font point changes.
Differential Revision: https://developer.blender.org/D9132
Reviewed by Hans Goudey
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_region_popover.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 80776c8d26e..1a9a663f94e 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -247,6 +247,8 @@ uiPopupBlockHandle *ui_popover_panel_create( bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg) { wmWindow *window = CTX_wm_window(C); + const uiStyle *style = UI_style_get_dpi(); + const PanelType *panel_type = (PanelType *)arg; /* Create popover, buttons are created from callback. */ uiPopover *pup = MEM_callocN(sizeof(uiPopover), __func__); @@ -254,8 +256,12 @@ uiPopupBlockHandle *ui_popover_panel_create( /* FIXME: maybe one day we want non panel popovers? */ { - const int ui_units_x = ((PanelType *)arg)->ui_units_x; - pup->ui_size_x = U.widget_unit * (ui_units_x ? ui_units_x : UI_POPOVER_WIDTH_UNITS); + const int ui_units_x = (panel_type->ui_units_x == 0) ? UI_POPOVER_WIDTH_UNITS : + panel_type->ui_units_x; + /* Scale width by changes to Text Style point size. */ + const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points); + pup->ui_size_x = ui_units_x * U.widget_unit * + (text_points_max / (float)UI_DEFAULT_TEXT_POINTS); } pup->menu_func = menu_func; |