Fix #137186: Allow Event Handling When Cursor Outside Wide Menus
When a wide menu is open and you move your mouse outside of it we have new code that prevents the immediate opening of neighboring menus. But while in this condition of mouse outside the menu, the rest of the event processing is not run, so pressing "escape" will not close it. This PR just moves the conditions around so event handling always continues unless another menu is opened. Pull Request: https://projects.blender.org/blender/blender/pulls/137243
This commit is contained in:
committed by
Harley Acheson
parent
d21b488ac9
commit
2f6a10c75e
@@ -12041,7 +12041,15 @@ static int ui_handle_region_semi_modal_buttons(bContext *C, const wmEvent *event
|
||||
/* Return true if we should open another menu while one is already open. */
|
||||
static bool ui_can_activate_other_menu(uiBut *but, uiBut *but_other, const wmEvent *event)
|
||||
{
|
||||
if (but_other->flag & UI_BUT_DISABLED) {
|
||||
if (but == but_other || but_other->flag & UI_BUT_DISABLED || but_other->menu_no_hover_open) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12118,10 +12126,8 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void * /*us
|
||||
(ui_region_find_active_but(data->menu->region) == nullptr) &&
|
||||
/* make sure mouse isn't inside another menu (see #43247) */
|
||||
(ui_screen_region_find_mouse_over(screen, event) == nullptr) &&
|
||||
ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU) &&
|
||||
(but_other = ui_but_find_mouse_over(region, event)) && (but != but_other) &&
|
||||
ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU) &&
|
||||
!but_other->menu_no_hover_open &&
|
||||
(but_other = ui_but_find_mouse_over(region, event)) &&
|
||||
ui_can_activate_other_menu(but, but_other, event) &&
|
||||
/* Hover-opening menu's doesn't work well for buttons over one another
|
||||
* along the same axis the menu is opening on (see #71719). */
|
||||
(((data->menu->direction & (UI_DIR_LEFT | UI_DIR_RIGHT)) &&
|
||||
@@ -12131,11 +12137,9 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void * /*us
|
||||
{
|
||||
/* if mouse moves to a different root-level menu button,
|
||||
* open it to replace the current menu */
|
||||
if (ui_can_activate_other_menu(but, but_other, event)) {
|
||||
ui_handle_button_activate(C, region, but_other, BUTTON_ACTIVATE_OVER);
|
||||
button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
ui_handle_button_activate(C, region, but_other, BUTTON_ACTIVATE_OVER);
|
||||
button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_MENU_OPEN) {
|
||||
/* handle events for menus and their buttons recursively,
|
||||
|
||||
Reference in New Issue
Block a user