[Bf-blender-cvs] [2bc6858021f] master: Fix T62524: Popover w/ keep-open moves on cursor motion

Campbell Barton noreply at git.blender.org
Wed Mar 13 06:42:56 CET 2019


Commit: 2bc6858021f920e3e930db2e466f239a3b9784bd
Author: Campbell Barton
Date:   Wed Mar 13 16:40:30 2019 +1100
Branches: master
https://developer.blender.org/rB2bc6858021f920e3e930db2e466f239a3b9784bd

Fix T62524: Popover w/ keep-open moves on cursor motion

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

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 e6e7cb33ad5..5710b7c3568 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -193,14 +193,13 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
 	}
 	else {
 		/* Not attached to a button. */
-		int offset[2] = {0, 0};
+		int bounds_offset[2] = {0, 0};
 		UI_block_flag_enable(block, UI_BLOCK_LOOP);
 		UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
 		UI_block_direction_set(block, block->direction);
 		block->minbounds = UI_MENU_WIDTH_MIN;
-		bool use_place_under_active = !handle->refresh;
 
-		if (use_place_under_active) {
+		if (!handle->refresh) {
 			uiBut *but = NULL;
 			for (but = block->buttons.first; but; but = but->next) {
 				if (but->flag & (UI_SELECT | UI_SELECT_DRAW)) {
@@ -209,12 +208,16 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
 			}
 
 			if (but) {
-				offset[0] = -(but->rect.xmin + 0.8f * BLI_rctf_size_x(&but->rect));
-				offset[1] = -(but->rect.ymin + 0.5f * BLI_rctf_size_y(&but->rect));
+				bounds_offset[0] = -(but->rect.xmin + 0.8f * BLI_rctf_size_x(&but->rect));
+				bounds_offset[1] = -(but->rect.ymin + 0.5f * BLI_rctf_size_y(&but->rect));
 			}
+			copy_v2_v2_int(handle->prev_bounds_offset, bounds_offset);
+		}
+		else {
+			copy_v2_v2_int(bounds_offset, handle->prev_bounds_offset);
 		}
 
-		UI_block_bounds_set_popup(block, block_margin, offset);
+		UI_block_bounds_set_popup(block, block_margin, bounds_offset);
 	}
 
 	return block;



More information about the Bf-blender-cvs mailing list