diff options
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 2a97ce8c904..a9a248f027b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -91,8 +91,9 @@ #include "DEG_depsgraph.h" -/* Motion in pixels allowed before we don't consider single/double click. */ -#define WM_EVENT_CLICK_WIGGLE_ROOM 2 +/* Motion in pixels allowed before we don't consider single/double click, + * or detect the start of a tweak event. */ +#define WM_EVENT_CLICK_TWEAK_THRESHOLD (U.tweak_threshold * U.dpi_fac) static void wm_notifier_clear(wmNotifier *note); static void update_tablet_data(wmWindow *win, wmEvent *event); @@ -2612,9 +2613,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) if (wm_action_not_handled(action)) { if (event->check_drag) { wmWindow *win = CTX_wm_window(C); - float tweak_threshold = U.tweak_threshold * U.dpi_fac; - if ((abs(event->x - win->eventstate->prevclickx)) >= tweak_threshold || - (abs(event->y - win->eventstate->prevclicky)) >= tweak_threshold) + if ((abs(event->x - win->eventstate->prevclickx)) >= WM_EVENT_CLICK_TWEAK_THRESHOLD || + (abs(event->y - win->eventstate->prevclicky)) >= WM_EVENT_CLICK_TWEAK_THRESHOLD) { int x = event->x; int y = event->y; @@ -2673,8 +2673,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) (win->eventstate->prevval == KM_PRESS) && (win->eventstate->check_click == true)) { - if ((abs(event->x - win->eventstate->prevclickx)) <= WM_EVENT_CLICK_WIGGLE_ROOM && - (abs(event->y - win->eventstate->prevclicky)) <= WM_EVENT_CLICK_WIGGLE_ROOM) + if ((abs(event->x - win->eventstate->prevclickx)) < WM_EVENT_CLICK_TWEAK_THRESHOLD && + (abs(event->y - win->eventstate->prevclicky)) < WM_EVENT_CLICK_TWEAK_THRESHOLD) { /* Position is where the actual click happens, for more * accurate selecting in case the mouse drifts a little. */ @@ -3784,8 +3784,8 @@ static bool wm_event_is_double_click(wmEvent *event, const wmEvent *event_state) (event->val == KM_PRESS)) { if ((ISMOUSE(event->type) == false) || - ((abs(event->x - event_state->prevclickx)) <= WM_EVENT_CLICK_WIGGLE_ROOM && - (abs(event->y - event_state->prevclicky)) <= WM_EVENT_CLICK_WIGGLE_ROOM)) + ((abs(event->x - event_state->prevclickx)) < WM_EVENT_CLICK_TWEAK_THRESHOLD && + (abs(event->y - event_state->prevclicky)) < WM_EVENT_CLICK_TWEAK_THRESHOLD)) { if ((PIL_check_seconds_timer() - event_state->prevclicktime) * 1000 < U.dbl_click_time) { return true; |