[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54246] trunk/blender/source/blender/ editors/interface/interface_handlers.c: fix for [#33803], error was caused by sloppy coding in r53487, converting trackpad to wheel events.

Campbell Barton ideasman42 at gmail.com
Fri Feb 1 02:11:33 CET 2013


Revision: 54246
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54246
Author:   campbellbarton
Date:     2013-02-01 01:11:27 +0000 (Fri, 01 Feb 2013)
Log Message:
-----------
fix for [#33803], error was caused by sloppy coding in r53487, converting trackpad to wheel events.

if you moved your mouse fast over a button the event would get converted to a wheel, even if the input event wasnt a MOUSEPAN event.

When Alt was held this was noticable because Alt+Wheel changes button values.

added an assert to avoid this happening again.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53487

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

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2013-02-01 01:01:20 UTC (rev 54245)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2013-02-01 01:11:27 UTC (rev 54246)
@@ -225,7 +225,11 @@
 {
 	static int lastdy = 0;
 	int dy = event->prevy - event->y;
-	
+
+	/* This event should be originally from event->type,
+	 * converting wrong event into wheel is bad, see [#33803] */
+	BLI_assert(*type == MOUSEPAN);
+
 	/* sign differs, reset */
 	if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0))
 		lastdy = dy;
@@ -2745,7 +2749,9 @@
 	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 		int type = event->type, val = event->val;
 		
-		ui_pan_to_scroll(event, &type, &val);
+		if (type == MOUSEPAN) {
+			ui_pan_to_scroll(event, &type, &val);
+		}
 		
 		/* XXX hardcoded keymap check.... */
 		if (type == MOUSEPAN && event->alt)
@@ -3004,9 +3010,11 @@
 
 	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 		int type = event->type, val = event->val;
-		
-		ui_pan_to_scroll(event, &type, &val);
 
+		if (type == MOUSEPAN) {
+			ui_pan_to_scroll(event, &type, &val);
+		}
+
 		/* XXX hardcoded keymap check.... */
 		if (type == MOUSEPAN && event->alt)
 			retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */




More information about the Bf-blender-cvs mailing list