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-03-19 18:48:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-19 18:52:55 +0300
commit57395061042fe336dae7ee33e3ae11e53d068194 (patch)
tree02ea901d9229e417647ecb39b3f7d04df2ef01ce /source/blender/windowmanager
parentbd803939957555e9c22b096365238704f55f6b3e (diff)
UI: scale cursor motion threshold by DPI
This was using hard coded values of 2-3px. Move both drag and motion thresholds to defines.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_types.h12
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c3
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c4
3 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 0f799448561..8ad63cb92c0 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -490,6 +490,18 @@ typedef struct wmEvent {
} wmEvent;
+/**
+ * Values below are considered a click, above are considered a drag.
+ */
+#define WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD (U.tweak_threshold * U.dpi_fac)
+
+/**
+ * Values below are ignored when detecting if the user interntionally moved the cursor.
+ * Keep this very small since it's used for selection cycling for eg,
+ * where we want intended adjustments to pass this threshold and select new items.
+ */
+#define WM_EVENT_CURSOR_MOTION_THRESHOLD (3 * U.dpi_fac)
+
/* ************** custom wmEvent data ************** */
typedef struct wmTabletData {
int Active; /* 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index e1eb735f074..42dd5e8f293 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -61,7 +61,6 @@
/* Allow gizmo part's to be single click only,
* dragging falls back to activating their 'drag_part' action. */
#define USE_DRAG_DETECT
-#define DRAG_THRESHOLD (U.tweak_threshold * U.dpi_fac)
/* -------------------------------------------------------------------- */
/** \name wmGizmoGroup
@@ -440,7 +439,7 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmGizmoMap *gzmap = mtweak->gzmap;
if (mtweak->drag_state == DRAG_DETECT) {
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
- if (len_manhattan_v2v2_int(&event->x, gzmap->gzmap_context.event_xy) >= DRAG_THRESHOLD) {
+ if (len_manhattan_v2v2_int(&event->x, gzmap->gzmap_context.event_xy) >= WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD) {
mtweak->drag_state = DRAG_IDLE;
gz->highlight_part = gz->drag_part;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 1ae3f7ffb79..a6e492e7449 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2729,8 +2729,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);
- if ((abs(event->x - win->eventstate->prevclickx)) >= WM_EVENT_CLICK_TWEAK_THRESHOLD ||
- (abs(event->y - win->eventstate->prevclicky)) >= WM_EVENT_CLICK_TWEAK_THRESHOLD)
+ if ((abs(event->x - win->eventstate->prevclickx)) >= WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD ||
+ (abs(event->y - win->eventstate->prevclicky)) >= WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD)
{
int x = event->x;
int y = event->y;