Partial fixes for #19881: Items existing on the same row as the window dividers are...
authorJoshua Leung <aligorith@gmail.com>
Wed, 18 Nov 2009 10:37:32 +0000 (10:37 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 18 Nov 2009 10:37:32 +0000 (10:37 +0000)
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.

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

index a84a393b3aeb904c2003b23d45389669fc11192d..5a1645b449ea42d64393bdb989322e75ce54ca09 100644 (file)
@@ -3747,26 +3747,55 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable)
 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;
 }
 
index ef37f6e530aa6f619bc85676e1c0f43342e9015e..79f000113e8218ac7a3d2685ad03d3cbc0defe26 100644 (file)
@@ -1285,6 +1285,13 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                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;