Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-30 07:47:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-30 08:03:19 +0300
commit0c8c1602029b5a0a34b7750c03b03fe990104c0e (patch)
tree5e807f8f58549936ca5cd072e0a16f4fd8092646 /source/blender/windowmanager
parent82e8e5c871f86e65f332cdde3bd484a55e7e8572 (diff)
WM: use different drag thresholds for mouse/tablet events
Now a small threshold is used for mouse input, avoiding delay when gizmos are activated on drag. Tablet input threshold remains unchanged since it's easier to make small movements when using a tablet. A larger threshold for non-cursor input is now used (typically keyboard) which improves usability when the "Pie Menu on Drag" key-map preference.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7aad89a4bdb..387bc949da8 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -5191,9 +5191,20 @@ bool WM_window_modal_keymap_status_draw(bContext *UNUSED(C), wmWindow *win, uiLa
*
* \{ */
-int WM_event_drag_threshold(const struct wmEvent *UNUSED(event))
+int WM_event_drag_threshold(const struct wmEvent *event)
{
- return (int)((float)U.tweak_threshold * U.dpi_fac);
+ int drag_threshold;
+ if (WM_event_is_tablet(event)) {
+ drag_threshold = U.drag_threshold_tablet;
+ }
+ else if (ISMOUSE(event->prevtype)) {
+ drag_threshold = U.drag_threshold_mouse;
+ }
+ else {
+ /* Typically keyboard, could be NDOF button or other less common types. */
+ drag_threshold = U.drag_threshold;
+ }
+ return drag_threshold * U.dpi_fac;
}
bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])