[Bf-blender-cvs] [27f29cdfba8] master: Fix T74038 : Scrolling doesn't work in menu if there is no active item
Valentin
noreply at git.blender.org
Tue Mar 24 21:41:24 CET 2020
Commit: 27f29cdfba889ffb07689a28a949de47b9392666
Author: Valentin
Date: Tue Mar 24 21:25:52 2020 +0100
Branches: master
https://developer.blender.org/rB27f29cdfba889ffb07689a28a949de47b9392666
Fix T74038 : Scrolling doesn't work in menu if there is no active item
Fix T74038, the logic didn't handle the case where there was not any button with focus.
Reviewed By: Julian Eisel
Maniphest Tasks: T74038
Differential Revision: https://developer.blender.org/D7208
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2dfa29f5646..07d5dd6e544 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9694,15 +9694,9 @@ static int ui_handle_menu_event(bContext *C,
/* Apply scroll operation. */
if (scrolltype == MENU_SCROLL_DOWN) {
but = ui_but_next(but);
- if (but == NULL) {
- but = ui_but_first(block);
- }
}
else if (scrolltype == MENU_SCROLL_UP) {
but = ui_but_prev(but);
- if (but == NULL) {
- but = ui_but_last(block);
- }
}
else if (scrolltype == MENU_SCROLL_TOP) {
but = ui_but_first(block);
@@ -9712,6 +9706,20 @@ static int ui_handle_menu_event(bContext *C,
}
}
+ if (!but) {
+ /* wrap button or no active button*/
+ uiBut *but_wrap = NULL;
+ if (ELEM(scrolltype, MENU_SCROLL_UP, MENU_SCROLL_BOTTOM)) {
+ but_wrap = ui_but_last(block);
+ }
+ else if (ELEM(scrolltype, MENU_SCROLL_DOWN, MENU_SCROLL_TOP)) {
+ but_wrap = ui_but_first(block);
+ }
+ if (but_wrap) {
+ but = but_wrap;
+ }
+ }
+
if (but) {
ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE);
ui_menu_scroll_to_but(region, block, but);
More information about the Bf-blender-cvs
mailing list