diff options
author | Julian Eisel <julian@blender.org> | 2022-01-03 21:20:00 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-01-03 21:55:49 +0300 |
commit | a42e972e1b9354911d9403840e137915a6c17b15 (patch) | |
tree | 3240adef945a660d37fdd51007917703eae3c1a4 /source/blender/editors/interface/interface_handlers.c | |
parent | 1b9e103a308c3ba20853487e1297df0653263ac9 (diff) |
Fix T94316: Asset catalog tree scrolls away when renaming a catalog
The activation of the text button is a bit special, since it happens during
drawing, the layout isn't computed yet then. Comparable cases where the button
is added on top don't use the layout system, so this didn't become an issue
until now. Trigger a delayed call to `UI_but_ensure_in_view()`.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index d720b52a59e..659ac0ae899 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3495,8 +3495,17 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_but_update(but); - /* Popup blocks don't support moving after creation, so don't change the view for them. */ - if (!data->searchbox) { + /* Make sure the edited button is in view. */ + if (data->searchbox) { + /* Popup blocks don't support moving after creation, so don't change the view for them. */ + } + else if (UI_block_layout_needs_resolving(but->block)) { + /* Layout isn't resolved yet (may happen when activating while drawing through + * #UI_but_active_only()), so can't move it into view yet. This causes + * #ui_but_update_view_for_active() to run after the layout is resolved. */ + but->changed = true; + } + else { UI_but_ensure_in_view(C, data->region, but); } |