[Bf-blender-cvs] [15fe7f3d936] master: Fix arrow key menu navigation using wrong direction
Julian Eisel
noreply at git.blender.org
Wed Nov 2 17:59:29 CET 2022
Commit: 15fe7f3d936a8f2a0bb82671cdf0a13f943cfdf7
Author: Julian Eisel
Date: Wed Nov 2 17:57:36 2022 +0100
Branches: master
https://developer.blender.org/rB15fe7f3d936a8f2a0bb82671cdf0a13f943cfdf7
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.
===================================================================
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_region_menu_popup.cc
===================================================================
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__);
More information about the Bf-blender-cvs
mailing list