diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-01 05:11:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-01 05:11:27 +0400 |
commit | a47bef36225b06fb2237bf2cd03332a1ee0337d5 (patch) | |
tree | df3bbaa24569b9f1b8bebf5abae66d6168054977 /source | |
parent | 63419193546b677103345a6543f8f99c4192293f (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 16 |
1 files 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) |