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/interface/interface_handlers.c | |
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/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 05d5f03a363..16996681695 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1886,11 +1886,13 @@ static bool ui_but_drag_init(bContext *C, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) { + const int ar_alignment = RGN_ALIGN_ENUM_FROM_MASK(data->region->alignment); int lock_axis = -1; - if (ELEM(data->region->alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { + + if (ELEM(ar_alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { lock_axis = 0; } - else if (ELEM(data->region->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) { + else if (ELEM(ar_alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) { lock_axis = 1; } if (lock_axis != -1) { |