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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-04-13 14:33:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-13 14:36:38 +0300
commit1534da457efcd52d06b2a9c8a488fe26224974b5 (patch)
tree5a09517482a12053d602a470384996104958911b /source
parent2f367db2cc638e47aa1c6644082070c290a8532d (diff)
Fix snap gizmo flickering while dragging
Ignore click-drag for non-mouse button drag events Alternative to fix issue detailed in D10886.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c2
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_query.c5
4 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 1a505b91ac5..280ee75a50f 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -861,6 +861,7 @@ int WM_event_modifier_flag(const struct wmEvent *event);
bool WM_event_is_modal_tweak_exit(const struct wmEvent *event, int tweak_event);
bool WM_event_is_last_mousemove(const struct wmEvent *event);
+bool WM_event_is_mouse_drag(const struct wmEvent *event);
int WM_event_drag_threshold(const struct wmEvent *event);
bool WM_event_drag_test(const struct wmEvent *event, const int prev_xy[2]);
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 32b6a6e6b31..ca1684811d5 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -592,7 +592,7 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const int highlight_part_init = gz->highlight_part;
if (gz->drag_part != -1) {
- if (ISTWEAK(event->type) || (event->val == KM_CLICK_DRAG)) {
+ if (WM_event_is_mouse_drag(event)) {
gz->highlight_part = gz->drag_part;
}
}
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 45950a32d85..a6e2ba49fe2 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -735,7 +735,7 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap,
/* Ensure for drag events we use the location where the user clicked.
* Without this click-dragging on a gizmo can accidentally act on the wrong gizmo. */
- if (ISTWEAK(event->type) || (event->val == KM_CLICK_DRAG)) {
+ if (WM_event_is_mouse_drag(event)) {
mval[0] += event->x - event->prevclickx;
mval[1] += event->y - event->prevclicky;
}
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c
index 9b9be6bb497..3efff20f107 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -265,6 +265,11 @@ bool WM_event_is_last_mousemove(const wmEvent *event)
return true;
}
+bool WM_event_is_mouse_drag(const wmEvent *event)
+{
+ return ISTWEAK(event->type) || (ISMOUSE_BUTTON(event->type) && (event->val == KM_CLICK_DRAG));
+}
+
/** \} */
/* -------------------------------------------------------------------- */