[Bf-blender-cvs] [4d5e83f608d] master: UI: move auto_open clearing out of ui_region_contains_point_px

Campbell Barton noreply at git.blender.org
Tue Apr 23 08:17:49 CEST 2019


Commit: 4d5e83f608d3cb7312383d4d90352a175594772e
Author: Campbell Barton
Date:   Tue Apr 23 15:44:31 2019 +1000
Branches: master
https://developer.blender.org/rB4d5e83f608d3cb7312383d4d90352a175594772e

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.

===================================================================

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_query.c

===================================================================

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;
   }



More information about the Bf-blender-cvs mailing list