diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 43 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 7 |
2 files changed, 43 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index a84a393b3ae..5a1645b449e 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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; } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index ef37f6e530a..79f000113e8 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -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; |