Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2020-01-16 17:55:49 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-01-16 18:13:15 +0300
commitd52551401e185a3e1092fb07edebd07d552e04e2 (patch)
tree0b109024b0acaedc9707f2d8034e8da82bf0d146 /source/blender/editors/interface/interface_panel.c
parent5b8c2301d8b7400013903fe0b02071ba19aafb9f (diff)
Fix wrong usages of region align enumerations
`ARegion.alignment` unfortunately is a mixture of value and bitflag enumerations. When checking for left/right/top/bottom region alignment, the flags have to be masked out usually. Most of the fixed cases here probably didn't cause issues in practice, but could in fact break at any point when surrounding logic changes. In fact the assert in #region_visible_rect_calc() failed in an older file from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949035. This fixes it.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 8adb82a22c8..3b21b689ba0 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1065,7 +1065,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
ps->pa->ofsy = -get_panel_size_y(ps->pa);
if (has_category_tabs) {
- if (align == BUT_VERTICAL && (ar->alignment != RGN_ALIGN_RIGHT)) {
+ if (align == BUT_VERTICAL && (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT)) {
ps->pa->ofsx += UI_PANEL_CATEGORY_MARGIN_WIDTH;
}
}
@@ -1913,7 +1913,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
{
/* no tab outlines for */
// #define USE_FLAT_INACTIVE
- const bool is_left = (ar->alignment != RGN_ALIGN_RIGHT);
+ const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment != RGN_ALIGN_RIGHT);
View2D *v2d = &ar->v2d;
uiStyle *style = UI_style_get();
const uiFontStyle *fstyle = &style->widget;
@@ -2201,7 +2201,7 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
{
const bool is_mousewheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
const bool inside_tabregion =
- ((ar->alignment != RGN_ALIGN_RIGHT) ?
+ ((RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT) ?
(event->mval[0] < ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmax) :
(event->mval[0] > ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmin));