[Bf-blender-cvs] [a3cd57ea8c5] blender2.8: Fix scrollbar operator showing in status bar cursor keymap.

Brecht Van Lommel noreply at git.blender.org
Tue Jun 26 20:25:10 CEST 2018


Commit: a3cd57ea8c57c10d4c65ddd51faa6cce14c98e10
Author: Brecht Van Lommel
Date:   Tue Jun 26 19:49:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa3cd57ea8c57c10d4c65ddd51faa6cce14c98e10

Fix scrollbar operator showing in status bar cursor keymap.

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

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

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

diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index b9e6d43aa87..3559e07f588 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -33,6 +33,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
@@ -1667,6 +1668,21 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
 	return SCROLLHANDLE_BAR;
 }
 
+static int scroller_activate_poll(bContext *C)
+{
+	if (!view2d_poll(C)) {
+		return false;
+	}
+
+	wmWindow *win = CTX_wm_window(C);
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
+	wmEvent *event = win->eventstate;
+
+	/* check if mouse in scrollbars, if they're enabled */
+	return (UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y) != 0);
+}
+
 /* initialize customdata for scroller manipulation operator */
 static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *event, short in_scroller)
 {
@@ -1997,7 +2013,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
 	ot->modal = scroller_activate_modal;
 	ot->cancel = scroller_activate_cancel;
 
-	ot->poll = view2d_poll;
+	ot->poll = scroller_activate_poll;
 }
 
 /* ********************************************************* */



More information about the Bf-blender-cvs mailing list