From a47bef36225b06fb2237bf2cd03332a1ee0337d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 1 Feb 2013 01:11:27 +0000 Subject: [PATCH] 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. --- .../editors/interface/interface_handlers.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 54d7493e516..c2ba69ae064 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -225,7 +225,11 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) { 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 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton 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,8 +3010,10 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton 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)