UI: Menu Status Text Clears Incorrectly

When we open dropdown (and context) menus we often show "Press spacebar
to search..." or "Type to search..." in the status bar. The status text
is set when menus are opened, and cleared when closed, but this means
that they are cleared when closing a submenu. This PR corrects this to
only clear then the base menu is freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/120351
This commit is contained in:
Harley Acheson
2024-04-07 03:02:01 +02:00
committed by Harley Acheson
parent 68060a9ccf
commit e5e6aa0bbf

View File

@@ -895,8 +895,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
/* This disables the status bar text that is set when opening a menu. */
ED_workspace_status_text(C, nullptr);
bool is_submenu = false;
/* If this popup is created from a popover which does NOT have keep-open flag set,
* then close the popover too. We could extend this to other popup types too. */
@@ -909,9 +908,18 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
uiPopupBlockHandle *menu = block->handle;
menu->menuretval = UI_RETURN_OK;
}
if (ui_block_is_menu(block)) {
is_submenu = true;
}
}
}
/* Clear the status bar text that is set when opening a menu. */
if (!is_submenu) {
ED_workspace_status_text(C, nullptr);
}
if (handle->popup_create_vars.arg_free) {
handle->popup_create_vars.arg_free(handle->popup_create_vars.arg);
}