diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-23 08:44:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-23 08:44:31 +0300 |
commit | 4d5e83f608d3cb7312383d4d90352a175594772e (patch) | |
tree | ad40d15829e0bd82a2440299c7eb9d6a7f390fa8 /source | |
parent | 3302fbaeb1d5f58d926c06b6153ec5d6f1a9b0be (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 72aa9920248..8125a42d3be 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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)) { diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index be09e44fa9d..9129bbddf69 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -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; } |