[Bf-blender-cvs] [b6a50b5dcb4] master: UI: Block Safety Not Scaled Correctly
Yevgeny Makarov
noreply at git.blender.org
Tue Nov 24 02:17:05 CET 2020
Commit: b6a50b5dcb461fe06cc3efc76b34e483a2ca6c0e
Author: Yevgeny Makarov
Date: Mon Nov 23 16:56:01 2020 -0800
Branches: master
https://developer.blender.org/rBb6a50b5dcb461fe06cc3efc76b34e483a2ca6c0e
UI: Block Safety Not Scaled Correctly
Layout block safety sizes were not scaled correctly with interface scale.
Differential Revision: https://developer.blender.org/D9569
Reviewed by Brecht Van Lommel
===================================================================
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_region_popup.c
===================================================================
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1b87f5081b6..685b34b7185 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -465,7 +465,7 @@ void ui_block_bounds_calc(uiBlock *block)
/* hardcoded exception... but that one is annoying with larger safety */
uiBut *bt = block->buttons.first;
- int xof = (bt && STRPREFIX(bt->str, "ERROR")) ? 10 : 40;
+ int xof = ((bt && STRPREFIX(bt->str, "ERROR")) ? 10 : 40) * U.dpi_fac;
block->safety.xmin = block->rect.xmin - xof;
block->safety.ymin = block->rect.ymin - xof;
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index f941474ba25..93e3dbb2cc8 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -308,43 +308,46 @@ static void ui_popup_block_position(wmWindow *window,
/* when you are outside parent button, safety there should be smaller */
+ const int s1 = 40 * U.dpi_fac;
+ const int s2 = 3 * U.dpi_fac;
+
/* parent button to left */
if (midx < block->rect.xmin) {
- block->safety.xmin = block->rect.xmin - 3;
+ block->safety.xmin = block->rect.xmin - s2;
}
else {
- block->safety.xmin = block->rect.xmin - 40;
+ block->safety.xmin = block->rect.xmin - s1;
}
/* parent button to right */
if (midx > block->rect.xmax) {
- block->safety.xmax = block->rect.xmax + 3;
+ block->safety.xmax = block->rect.xmax + s2;
}
else {
- block->safety.xmax = block->rect.xmax + 40;
+ block->safety.xmax = block->rect.xmax + s1;
}
/* parent button on bottom */
if (midy < block->rect.ymin) {
- block->safety.ymin = block->rect.ymin - 3;
+ block->safety.ymin = block->rect.ymin - s2;
}
else {
- block->safety.ymin = block->rect.ymin - 40;
+ block->safety.ymin = block->rect.ymin - s1;
}
/* parent button on top */
if (midy > block->rect.ymax) {
- block->safety.ymax = block->rect.ymax + 3;
+ block->safety.ymax = block->rect.ymax + s2;
}
else {
- block->safety.ymax = block->rect.ymax + 40;
+ block->safety.ymax = block->rect.ymax + s1;
}
/* exception for switched pulldowns... */
if (dir1 && (dir1 & block->direction) == 0) {
if (dir2 == UI_DIR_RIGHT) {
- block->safety.xmax = block->rect.xmax + 3;
+ block->safety.xmax = block->rect.xmax + s2;
}
if (dir2 == UI_DIR_LEFT) {
- block->safety.xmin = block->rect.xmin - 3;
+ block->safety.xmin = block->rect.xmin - s2;
}
}
block->direction = dir1;
More information about the Bf-blender-cvs
mailing list