diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-07 17:19:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-07 17:19:59 +0300 |
commit | e19686a35a7e12204117f871a04e6f6b5a71cc2b (patch) | |
tree | 75692ffafe4595aff06199a9861dd24b18952ea6 /source/blender/editors/interface | |
parent | 8a2db3ed21c0eff7ee293c6a24c614283a8ed73f (diff) |
WM: check for release instead of not pressed
Makes reasoning about events more predictable.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 590b34dfc21..3abaa1d88eb 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1364,7 +1364,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void switch (event->type) { case LEFTMOUSE: { - if (event->val != KM_PRESS) { + if (event->val == KM_RELEASE) { done = true; } break; @@ -3776,7 +3776,7 @@ static int ui_do_but_BUT( } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (!(but->flag & UI_SELECT)) data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4400,7 +4400,7 @@ static int ui_do_but_NUM( button_activate_state(C, but, BUTTON_STATE_EXIT); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM /* if we started multibutton but didnt drag, then edit */ @@ -4711,7 +4711,7 @@ static int ui_do_but_SLI( button_activate_state(C, but, BUTTON_STATE_EXIT); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM /* if we started multibutton but didnt drag, then edit */ @@ -4864,7 +4864,7 @@ static int ui_do_but_SCROLL( button_activate_state(C, but, BUTTON_STATE_EXIT); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->type == MOUSEMOVE) { @@ -4916,7 +4916,7 @@ static int ui_do_but_GRIP( button_activate_state(C, but, BUTTON_STATE_EXIT); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->type == MOUSEMOVE) { @@ -5301,7 +5301,7 @@ static int ui_do_but_UNITVEC( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -5635,7 +5635,7 @@ static int ui_do_but_HSVCUBE( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -5913,7 +5913,7 @@ static int ui_do_but_HSVCIRCLE( } } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -6003,7 +6003,7 @@ static int ui_do_but_COLORBAND( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { @@ -6253,7 +6253,7 @@ static int ui_do_but_CURVE( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragsel != -1) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; @@ -6351,7 +6351,7 @@ static int ui_do_but_HISTOGRAM( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -6426,7 +6426,7 @@ static int ui_do_but_WAVEFORM( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -6453,7 +6453,7 @@ static int ui_do_but_LINK( } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (!(but->flag & UI_SELECT)) data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -6539,7 +6539,7 @@ static int ui_do_but_TRACKPREVIEW( ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; |