UI: move auto_open clearing out of ui_region_contains_point_px
Prefer explicit call for menu buttons since it's confusing if only some queries clear auto open. Also queries shouldn't modify data.
This commit is contained in:
parent
3302fbaeb1
commit
4d5e83f608
|
@ -8742,6 +8742,13 @@ static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_di
|
|||
/** \name Menu Event Handling
|
||||
* \{ */
|
||||
|
||||
static void ui_region_auto_open_clear(ARegion *ar)
|
||||
{
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
block->auto_open = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special function to handle nested menus.
|
||||
* let the parent menu get the event.
|
||||
|
@ -8784,6 +8791,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
|
|||
}
|
||||
else if (!ui_region_contains_point_px(but->active->region, event->x, event->y)) {
|
||||
/* pass, needed to click-exit outside of non-flaoting menus */
|
||||
ui_region_auto_open_clear(but->active->region);
|
||||
}
|
||||
else if ((!ELEM(event->type, MOUSEMOVE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN)) &&
|
||||
ISMOUSE(event->type)) {
|
||||
|
|
|
@ -497,10 +497,6 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
|
|||
|
||||
/* check if the mouse is in the region */
|
||||
if (!BLI_rcti_isect_pt(&winrct, x, y)) {
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
block->auto_open = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue