diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2020-01-16 17:55:49 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2020-01-16 18:13:15 +0300 |
commit | d52551401e185a3e1092fb07edebd07d552e04e2 (patch) | |
tree | 0b109024b0acaedc9707f2d8034e8da82bf0d146 /source/blender/editors/space_topbar | |
parent | 5b8c2301d8b7400013903fe0b02071ba19aafb9f (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/space_topbar')
-rw-r--r-- | source/blender/editors/space_topbar/space_topbar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index 725a49e417e..d62fcf45d68 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -103,7 +103,7 @@ static void topbar_main_region_init(wmWindowManager *wm, ARegion *region) wmKeyMap *keymap; /* force delayed UI_view2d_region_reinit call */ - if (ELEM(region->alignment, RGN_ALIGN_RIGHT)) { + if (ELEM(RGN_ALIGN_ENUM_FROM_MASK(region->alignment), RGN_ALIGN_RIGHT)) { region->flag |= RGN_FLAG_DYNAMIC_SIZE; } UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_HEADER, region->winx, region->winy); @@ -123,7 +123,7 @@ static void topbar_keymap(struct wmKeyConfig *UNUSED(keyconf)) /* add handlers, stuff you only do once or on area/region changes */ static void topbar_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) { - if ((ar->alignment & ~RGN_SPLIT_PREV) == RGN_ALIGN_RIGHT) { + if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_RIGHT) { ar->flag |= RGN_FLAG_DYNAMIC_SIZE; } ED_region_header_init(ar); |