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
This commit is contained in:
parent
394a1373a0
commit
27f29cdfba
Notes:
blender-bot
2024-02-13 05:06:31 +01:00
Referenced by issue #74038, Scrolling doesn't work unless pointer in on any menu item Referenced by issue #118180, Odd menubar mouse scroll behavior
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue