[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24632] trunk/blender/source/blender/ editors/interface: Partial fixes for #19881: Items existing on the same row as the window dividers are not interactive (selectable, etc.)

Joshua Leung aligorith at gmail.com
Wed Nov 18 11:37:32 CET 2009


Revision: 24632
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24632
Author:   aligorith
Date:     2009-11-18 11:37:32 +0100 (Wed, 18 Nov 2009)

Log Message:
-----------
Partial fixes for #19881: Items existing on the same row as the window dividers are not interactive (selectable, etc.)

The View 2D function for handling scrollbar events now takes into account whether the scrollbar is visible or not, so that it won't block events when the scrollbar isn't visible.

Also, made the UI code take this into account too for its region testing code. Unforunately, there still seems to be something else which is still preventing UI buttons from being processed when they are in those regions.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/view2d_ops.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2009-11-18 09:49:42 UTC (rev 24631)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2009-11-18 10:37:32 UTC (rev 24632)
@@ -3747,26 +3747,55 @@
 static int ui_mouse_inside_region(ARegion *ar, int x, int y)
 {
 	uiBlock *block;
-	int mx, my;
+	
 
-	/* check if the mouse is in the region, and in case of a view2d also check
-	 * if it is inside the view2d itself, not over scrollbars for example */
+	/* check if the mouse is in the region */
 	if(!BLI_in_rcti(&ar->winrct, x, y)) {
 		for(block=ar->uiblocks.first; block; block=block->next)
 			block->auto_open= 0;
-
+		
 		return 0;
 	}
 
+	/* also, check that with view2d, that the mouse is not over the scrollbars 
+	 * NOTE: care is needed here, since the mask rect may include the scrollbars
+	 * even when they are not visible, so we need to make a copy of the mask to
+	 * use to check
+	 */
 	if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
+		View2D *v2d= &ar->v2d;
+		rcti mask_rct;
+		int mx, my;
+		
+		/* convert window coordinates to region coordinates */
 		mx= x;
 		my= y;
 		ui_window_to_region(ar, &mx, &my);
-
-		if(!BLI_in_rcti(&ar->v2d.mask, mx, my))
+		
+		/* make a copy of the mask rect, and tweak accordingly for hidden scrollbars */
+		mask_rct.xmin= v2d->mask.xmin;
+		mask_rct.xmax= v2d->mask.xmax;
+		mask_rct.ymin= v2d->mask.ymin;
+		mask_rct.ymax= v2d->mask.ymax;
+		
+		if (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE) {
+			if (v2d->scroll & V2D_SCROLL_LEFT)
+				mask_rct.xmin= v2d->vert.xmin;
+			else if (v2d->scroll & V2D_SCROLL_RIGHT)
+				mask_rct.xmax= v2d->vert.xmax;
+		}
+		if (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE) {
+			if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
+				mask_rct.ymin= v2d->hor.ymin;
+			else if (v2d->scroll & V2D_SCROLL_TOP)
+				mask_rct.ymax= v2d->hor.ymax;
+		}
+		
+		/* check if in the rect */
+		if(!BLI_in_rcti(&mask_rct, mx, my)) 
 			return 0;
 	}
-
+	
 	return 1;
 }
 

Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d_ops.c	2009-11-18 09:49:42 UTC (rev 24631)
+++ trunk/blender/source/blender/editors/interface/view2d_ops.c	2009-11-18 10:37:32 UTC (rev 24632)
@@ -1285,6 +1285,13 @@
 				return OPERATOR_PASS_THROUGH;
 			}			
 		}
+		/* zone is also inappropriate if scroller is not visible... */
+		if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HIDE)) ||
+			 ((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_VERTICAL_HIDE)) )
+		{
+			/* can't catch this event for ourselves, so let it go to someone else? */
+			return OPERATOR_PASS_THROUGH;
+		}
 		
 		if(vsm->scroller=='h')
 			v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;





More information about the Bf-blender-cvs mailing list