From 7197017ea951eadddeea5a7b3941cabee2b960db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 4 Jun 2021 01:15:15 +1000 Subject: [PATCH] WM: only use the tablet drag threshold for mouse button events Keyboard click-drag events now use the "Drag Threshold". This resolves a problem where keyboard click drag events used a much smaller threshold when using a tablet. --- source/blender/windowmanager/intern/wm_event_query.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index 3efff20f107..0050c834a56 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -282,15 +282,17 @@ bool WM_event_is_mouse_drag(const wmEvent *event) int WM_event_drag_threshold(const struct wmEvent *event) { int drag_threshold; - if (WM_event_is_tablet(event)) { - drag_threshold = U.drag_threshold_tablet; - } - else if (ISMOUSE(event->prevtype)) { + if (ISMOUSE(event->prevtype)) { BLI_assert(event->prevtype != MOUSEMOVE); /* Using the previous type is important is we want to check the last pressed/released button, * The `event->type` would include #MOUSEMOVE which is always the case when dragging * and does not help us know which threshold to use. */ - drag_threshold = U.drag_threshold_mouse; + if (WM_event_is_tablet(event)) { + drag_threshold = U.drag_threshold_tablet; + } + else { + drag_threshold = U.drag_threshold_mouse; + } } else { /* Typically keyboard, could be NDOF button or other less common types. */