Fix #126409: Allow Menu Accelerators for Toggles

When menus (that are not type-to-search) open we add underlines to
most items so they can be selected quickly. We currently don't do this
for items that are toggles.  This PR adds accelerators to toggles.

Pull Request: https://projects.blender.org/blender/blender/pulls/132309
This commit is contained in:
Harley Acheson
2025-01-13 19:14:12 +01:00
committed by Harley Acheson
parent 2c92cfb687
commit ba9417470e
2 changed files with 8 additions and 1 deletions

View File

@@ -1164,6 +1164,9 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
UI_BTYPE_MENU,
UI_BTYPE_BLOCK,
UI_BTYPE_PULLDOWN,
UI_BTYPE_ICON_TOGGLE,
UI_BTYPE_ICON_TOGGLE_N,
/* For PIE-menus. */
UI_BTYPE_ROW) ||
(but->flag & UI_HIDDEN))

View File

@@ -11111,7 +11111,11 @@ static int ui_handle_menu_event(bContext *C,
/* Accelerator keys that allow "pressing" a menu entry by pressing a single key. */
LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
if (!(but_iter->flag & UI_BUT_DISABLED) && but_iter->menu_key == event->type) {
if (but_iter->type == UI_BTYPE_BUT) {
if (ELEM(but_iter->type,
UI_BTYPE_BUT,
UI_BTYPE_ICON_TOGGLE,
UI_BTYPE_ICON_TOGGLE_N))
{
UI_but_execute(C, region, but_iter);
}
else {