diff options
author | Julian Eisel <julian@blender.org> | 2022-11-02 19:57:36 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-11-02 19:57:36 +0300 |
commit | 15fe7f3d936a8f2a0bb82671cdf0a13f943cfdf7 (patch) | |
tree | 53465968c1d12b33477a1714b39c4ca420f1c699 /source | |
parent | 31746e1baa14fd3a64053aec82a40ffc07f95973 (diff) |
Fix arrow key menu navigation using wrong direction
Steps to reproduce were:
* Right click in 3D View (context menu) press up or down arrow.
Or:
* Ctrl+Shift+O (Open Recent menu) press up or down arrow.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_region_menu_popup.cc | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 1098266331f..66b3d9fba6b 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -133,6 +133,8 @@ enum { /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, + /** Indicate that items in a popup are drawn with inverted order. Used for arrow key navigation + * so that it knows to invert the navigation direction to match the drawing order. */ UI_BLOCK_IS_FLIP = 1 << 1, UI_BLOCK_NO_FLIP = 1 << 2, UI_BLOCK_NUMSELECT = 1 << 3, diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc b/source/blender/editors/interface/interface_region_menu_popup.cc index 0d19390d508..b8c8cdf5fa4 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.cc +++ b/source/blender/editors/interface/interface_region_menu_popup.cc @@ -189,7 +189,7 @@ static void ui_popup_menu_create_block(bContext *C, pup->block = UI_block_begin(C, nullptr, block_name, UI_EMBOSS_PULLDOWN); if (!pup->but) { - pup->block->flag |= UI_BLOCK_IS_FLIP | UI_BLOCK_NO_FLIP; + pup->block->flag |= UI_BLOCK_NO_FLIP; } if (title && title[0]) { pup->block->flag |= UI_BLOCK_POPUP_MEMORY; @@ -486,6 +486,8 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, pup->title = title; ui_popup_menu_create_block(C, pup, title, block_name); + /* Further buttons will be laid out top to bottom by default. */ + pup->block->flag |= UI_BLOCK_IS_FLIP; /* create in advance so we can let buttons point to retval already */ pup->block->handle = MEM_cnew<uiPopupBlockHandle>(__func__); |