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-29 11:13:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-29 11:13:33 +0300
commit07d453dd9e0207ff74c0f85583ef9fcc8d54a218 (patch)
tree00af234ccda861f81cbf1b0035e081ae04129241 /source/blender/windowmanager
parent8949dfb7a6e2cc9c24d43b0cac4342a1962e22d9 (diff)
UI: use matching distance checks & define for dragging
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c14
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c4
2 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 198e26aa465..04ff29b6fbf 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -87,10 +87,6 @@
#include "DEG_depsgraph.h"
-/* 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);
@@ -2932,8 +2928,10 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if ((event->val == KM_RELEASE) && (win->eventstate->prevval == KM_PRESS) &&
(win->eventstate->check_click == true)) {
- 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) {
/* Position is where the actual click happens, for more
* accurate selecting in case the mouse drifts a little. */
int x = event->x;
@@ -4261,8 +4259,8 @@ static bool wm_event_is_double_click(wmEvent *event, const wmEvent *event_state)
if ((event->type == event_state->prevtype) && (event_state->prevval == KM_RELEASE) &&
(event->val == KM_PRESS)) {
if ((ISMOUSE(event->type) == false) ||
- ((abs(event->x - event_state->prevclickx)) < WM_EVENT_CLICK_TWEAK_THRESHOLD &&
- (abs(event->y - event_state->prevclicky)) < WM_EVENT_CLICK_TWEAK_THRESHOLD)) {
+ ((abs(event->x - event_state->prevclickx)) < WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD &&
+ (abs(event->y - event_state->prevclicky)) < WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD)) {
if ((PIL_check_seconds_timer() - event_state->prevclicktime) * 1000 < U.dbl_click_time) {
return true;
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index e117a1bcdfe..bc985087475 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -134,8 +134,8 @@ int wm_gesture_evaluate(wmGesture *gesture)
rcti *rect = gesture->customdata;
int dx = BLI_rcti_size_x(rect);
int dy = BLI_rcti_size_y(rect);
- float tweak_threshold = U.tweak_threshold * U.dpi_fac;
- if (abs(dx) + abs(dy) > tweak_threshold) {
+ const int drag_threshold = WM_EVENT_CURSOR_CLICK_DRAG_THRESHOLD;
+ if (abs(dx) >= drag_threshold || abs(dy) >= drag_threshold) {
int theta = round_fl_to_int(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI);
int val = EVT_GESTURE_W;