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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-21 21:25:13 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-21 21:31:20 +0300
commit0a3cf083641121765fc78277f00d89af6d2cfebc (patch)
tree7ffccf7abc783f9e43119c166fb15fafc9fd9b14 /source/blender/windowmanager
parente8b9ff78dcb5e8e4dcf8f3383f9e8c55a8533b17 (diff)
Keymaps: take into account DPI for tweak/drag/pie thresholds.
The intention is to fix a too low default threshold on high DPI screen. Users with high DPI screens that have increased the threshold to fix this or liked the lower threshold will need to lower it again. This is still somewhat of a guess, ideally this would be based on the physical distance travalled, and maybe different per type of input device. However we do not have access to this information, and hope this gives a better default.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c5
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 03a80ff240b..2a97ce8c904 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2612,8 +2612,9 @@ 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)) >= U.tweak_threshold ||
- (abs(event->y - win->eventstate->prevclicky)) >= U.tweak_threshold)
+ 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)
{
int x = event->x;
int y = event->y;
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 06a7f3528c5..70150e40142 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -130,7 +130,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);
- if (abs(dx) + abs(dy) > U.tweak_threshold) {
+ float tweak_threshold = U.tweak_threshold * U.dpi_fac;
+ if (abs(dx) + abs(dy) > tweak_threshold) {
int theta = round_fl_to_int(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI);
int val = EVT_GESTURE_W;