Commit: d2859237fa108f77814a6270d592b55a2b63c255
Author: Campbell Barton
Date:   Mon Apr 29 15:25:56 2019 +1000
Branches: master
https://developer.blender.org/rBd2859237fa108f77814a6270d592b55a2b63c255

Fix T63898: "Open on Mouse Over" causes inconsistent draw-style

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

M       source/blender/editors/interface/interface_region_popover.c

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

diff --git a/source/blender/editors/interface/interface_region_popover.c 
b/source/blender/editors/interface/interface_region_popover.c
index 110c8827849..f149ccd626c 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -257,6 +257,8 @@ static void ui_block_free_func_POPOVER(uiPopupBlockHandle 
*UNUSED(handle), void
 uiPopupBlockHandle *ui_popover_panel_create(
     bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, 
void *arg)
 {
+  wmWindow *window = CTX_wm_window(C);
+
   /* Create popover, buttons are created from callback. */
   uiPopover *pup = MEM_callocN(sizeof(uiPopover), __func__);
   pup->but = but;
@@ -271,7 +273,11 @@ uiPopupBlockHandle *ui_popover_panel_create(
   pup->menu_arg = arg;
 
 #ifdef USE_UI_POPOVER_ONCE
-  pup->is_once = true;
+  {
+    /* Ideally this would be passed in. */
+    const wmEvent *event = window->eventstate;
+    pup->is_once = (event->type == LEFTMOUSE) && (event->val == KM_PRESS);
+  }
 #endif
 
   /* Create popup block. */
@@ -283,7 +289,6 @@ uiPopupBlockHandle *ui_popover_panel_create(
   /* Add handlers. If attached to a button, the button will already
    * add a modal handler and pass on events. */
   if (!but) {
-    wmWindow *window = CTX_wm_window(C);
     UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
     WM_event_add_mousemove(C);
     handle->popup = true;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to