WM: move WM_event_is_last_mousemove to the WM API

This commit is contained in:
Campbell Barton 2017-07-18 18:06:21 +10:00
parent 5f35682f3a
commit 7784cf30eb
3 changed files with 12 additions and 11 deletions

@ -674,16 +674,6 @@ static int walkEnd(bContext *C, WalkInfo *walk)
return OPERATOR_CANCELLED;
}
static bool wm_event_is_last_mousemove(const wmEvent *event)
{
while ((event = event->next)) {
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
return false;
}
}
return true;
}
static void walkEvent(bContext *C, wmOperator *op, WalkInfo *walk, const wmEvent *event)
{
if (event->type == TIMER && event->customdata == walk->timer) {
@ -736,7 +726,7 @@ static void walkEvent(bContext *C, wmOperator *op, WalkInfo *walk, const wmEvent
}
else
#endif
if (wm_event_is_last_mousemove(event)) {
if (WM_event_is_last_mousemove(event)) {
wmWindow *win = CTX_wm_window(C);
#ifdef __APPLE__

@ -189,6 +189,7 @@ struct wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase
void WM_event_add_mousemove(struct bContext *C);
bool WM_modal_tweak_exit(const struct wmEvent *event, int tweak_event);
bool WM_event_is_absolute(const struct wmEvent *event);
bool WM_event_is_last_mousemove(const struct wmEvent *event);
#ifdef WITH_INPUT_NDOF
/* 3D mouse */

@ -615,6 +615,16 @@ bool WM_event_is_absolute(const wmEvent *event)
return (event->tablet_data != NULL);
}
bool WM_event_is_last_mousemove(const wmEvent *event)
{
while ((event = event->next)) {
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
return false;
}
}
return true;
}
#ifdef WITH_INPUT_NDOF
void WM_ndof_deadzone_set(float deadzone)
{