[Bf-blender-cvs] [d9a720a] master: Fix T45750: Closing search menu by clicking root button doesn't work when clicking on lower half

Julian Eisel noreply at git.blender.org
Fri Aug 14 22:23:19 CEST 2015


Commit: d9a720a709c8c4358edb3051c0f2c0daf4482cd2
Author: Julian Eisel
Date:   Fri Aug 14 22:09:31 2015 +0200
Branches: master
https://developer.blender.org/rBd9a720a709c8c4358edb3051c0f2c0daf4482cd2

Fix T45750: Closing search menu by clicking root button doesn't work when clicking on lower half

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

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

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 82660a8..0adbd05 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7225,10 +7225,19 @@ static void ui_blocks_set_tooltips(ARegion *ar, const bool enable)
 
 static bool ui_region_contains_point_px(ARegion *ar, int x, int y)
 {
-	uiBlock *block;
-	
+	uiBlock *block = ar->uiblocks.first;
+	rcti rect = ar->winrct;
+	const bool is_block_loop = block->flag & UI_BLOCK_LOOP;
+
+	/* scale down area rect to exclude shadow */
+	if (is_block_loop) {
+		const int shadow_xy = UI_ThemeMenuShadowWidth();
+		BLI_rcti_resize(&rect, BLI_rcti_size_x(&ar->winrct) - shadow_xy * 2,
+		                BLI_rcti_size_y(&ar->winrct) - shadow_xy * 2);
+	}
+
 	/* check if the mouse is in the region */
-	if (!BLI_rcti_isect_pt(&ar->winrct, x, y)) {
+	if (!BLI_rcti_isect_pt(&rect, x, y)) {
 		for (block = ar->uiblocks.first; block; block = block->next)
 			block->auto_open = false;




More information about the Bf-blender-cvs mailing list