From 811ac2965a580e3af2d9e7a82afa1b9699d6c1f7 Mon Sep 17 00:00:00 2001 From: Yevgeny Makarov Date: Tue, 27 Aug 2019 12:16:16 +0200 Subject: UI: fix some menus and popups not taking into account UI scale for padding Differential Revision: https://developer.blender.org/D5581 --- source/blender/editors/interface/interface_templates.c | 2 +- source/blender/editors/space_node/node_select.c | 16 +++++++++++++--- source/blender/windowmanager/intern/wm_operators.c | 11 ++++++----- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1c6618bc509..cae2338389a 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6622,7 +6622,7 @@ static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v) uiItemR(layout, &args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE); - UI_block_bounds_set_normal(block, 6); + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); UI_block_direction_set(block, UI_DIR_DOWN); return block; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 78f36719880..450cf28cce1 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1234,8 +1234,18 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); - but = uiDefSearchBut( - block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); + but = uiDefSearchBut(block, + search, + 0, + ICON_VIEWZOOM, + sizeof(search), + 10, + 10, + UI_searchbox_size_x(), + UI_UNIT_Y, + 0, + 0, + ""); UI_but_func_search_set(but, NULL, node_find_cb, op->type, false, node_find_call_cb, NULL); UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); @@ -1256,7 +1266,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) NULL); /* Move it downwards, mouse over button. */ - UI_block_bounds_set_popup(block, 6, (const int[2]){0, -UI_UNIT_Y}); + UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y}); return block; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index c6e2ed4612d..b33b4184424 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -850,7 +850,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg) NULL); /* Move it downwards, mouse over button. */ - UI_block_bounds_set_popup(block, 6, (const int[2]){0, -UI_UNIT_Y}); + UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y}); UI_but_focus_on_enter_event(win, but); @@ -1134,7 +1134,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) C, layout, op, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_SHOW_TITLE); } - UI_block_bounds_set_popup(block, 4, NULL); + UI_block_bounds_set_popup(block, 6 * U.dpi_fac, NULL); return block; } @@ -1214,7 +1214,8 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) } /* center around the mouse */ - UI_block_bounds_set_popup(block, 4, (const int[2]){data->width / -2, data->height / 2}); + UI_block_bounds_set_popup( + block, 6 * U.dpi_fac, (const int[2]){data->width / -2, data->height / 2}); UI_block_active_only_flagged_buttons(C, ar, block); @@ -1242,7 +1243,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) UI_block_func_set(block, NULL, NULL, NULL); - UI_block_bounds_set_popup(block, 4, NULL); + UI_block_bounds_set_popup(block, 6 * U.dpi_fac, NULL); UI_block_active_only_flagged_buttons(C, ar, block); @@ -1513,7 +1514,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata) NULL); /* Move it downwards, mouse over button. */ - UI_block_bounds_set_popup(block, 6, (const int[2]){0, -UI_UNIT_Y}); + UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y}); return block; } -- cgit v1.2.3