Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin <Poulpator>2020-03-24 23:25:52 +0300
committerJulian Eisel <julian@blender.org>2020-03-24 23:40:36 +0300
commit27f29cdfba889ffb07689a28a949de47b9392666 (patch)
tree59c75d2a462b55aced55785c5158591668813a07 /source/blender/editors/interface
parent394a1373a0cd20b7d0660df4bf80e1231e33cba9 (diff)
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
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_handlers.c20
1 files changed, 14 insertions, 6 deletions
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);