diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 15:34:11 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 16:17:52 +0300 |
commit | 49f088e2d0936ed3b5f08881a14ad83c19951791 (patch) | |
tree | e0d64f096345e3cda1e18a248a09a52869e37407 /source/blender/editors/interface/interface_query.c | |
parent | 48e089375ebe4aeb30d60e9d8ef6f467280cf07d (diff) |
UI Code Quality: Use derived structs for search buttons and decorators
The current on-size-fits-all `uiBut` creates quite a mess, where it's
hard to reason about which members are free for use, under which
conditions they are used and how.
`uiBut` also has members that aren't used at times, violating the "don't
pay for what you don't use" principle.
To address this, we want to move to typed buttons, where `uiBut` is just
a base struct and each type extends it as needed. That structures data
better and type specific data is only available if it's actually used by
a button type.
Two trade-offs:
* Many casts to the derived type have to be done.
* Sometimes we change the button type after it's created. So I had to
add logic to reallocate the button for use with the new, possibly
derived struct. Ideally that wouldn't be needed, but for now that's
what we have.
Part of T74432.
Differential Revision: https://developer.blender.org/D7610
Reviewed by: Brecht Van Lommel, Campbell Barton
Diffstat (limited to 'source/blender/editors/interface/interface_query.c')
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 10b219202e5..edb5d51a392 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -113,7 +113,7 @@ bool UI_but_is_utf8(const uiBut *but) #ifdef USE_UI_POPOVER_ONCE bool ui_but_is_popover_once_compat(const uiBut *but) { - return ((but->type == UI_BTYPE_BUT) || ui_but_is_toggle(but)); + return (ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_DECORATOR) || ui_but_is_toggle(but)); } #endif |