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:
-rw-r--r--source/blender/editors/animation/anim_markers.c5
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/intern/wm_event_query.c27
3 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index ab51702d628..95125516fe8 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -700,7 +700,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
typedef struct MarkerMove {
SpaceLink *slink;
ListBase *markers;
- int event_type; /* store invoke-event, to verify */
+ short event_type, event_val; /* store invoke-event, to verify */
int *oldframe, evtx, firstx;
NumInput num;
} MarkerMove;
@@ -844,6 +844,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
mm->evtx = event->xy[0];
mm->firstx = event->xy[0];
mm->event_type = event->type;
+ mm->event_val = event->val;
/* add temp handler */
WM_event_add_modal_handler(C, op);
@@ -941,7 +942,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
case EVT_PADENTER:
case LEFTMOUSE:
case MIDDLEMOUSE:
- if (WM_event_is_modal_tweak_exit(event, mm->event_type)) {
+ if (WM_event_is_modal_drag_exit(event, mm->event_type, mm->event_val)) {
ed_marker_move_exit(C, op);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2c2143f350a..07eaa2ab976 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -1424,9 +1424,11 @@ bool WM_window_modal_keymap_status_draw(struct bContext *C,
void WM_event_print(const struct wmEvent *event);
/**
- * For modal callbacks, check configuration for how to interpret exit with tweaks.
+ * For modal callbacks, check configuration for how to interpret exit when dragging.
*/
-bool WM_event_is_modal_tweak_exit(const struct wmEvent *event, int tweak_event);
+bool WM_event_is_modal_drag_exit(const struct wmEvent *event,
+ short init_event_type,
+ short init_event_val);
bool WM_event_is_last_mousemove(const struct wmEvent *event);
bool WM_event_is_mouse_drag(const struct wmEvent *event);
bool WM_event_is_mouse_drag_or_press(const wmEvent *event);
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c
index 5e8b9b945c9..ddca10a8382 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -183,34 +183,37 @@ bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask ma
/** \name Event Motion Queries
* \{ */
-bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
+bool WM_event_is_modal_drag_exit(const wmEvent *event,
+ const short init_event_type,
+ const short init_event_val)
{
- /* if the release-confirm userpref setting is enabled,
- * tweak events can be canceled when mouse is released
- */
+ /* If the release-confirm preference setting is enabled,
+ * drag events can be canceled when mouse is released. */
if (U.flag & USER_RELEASECONFIRM) {
/* option on, so can exit with km-release */
if (event->val == KM_RELEASE) {
- switch (tweak_event) {
+ switch (init_event_type) {
case EVT_TWEAK_L:
case EVT_TWEAK_M:
case EVT_TWEAK_R:
return 1;
}
+ if ((init_event_val == KM_CLICK_DRAG) && (event->type == init_event_type)) {
+ return 1;
+ }
}
else {
- /* if the initial event wasn't a tweak event then
- * ignore USER_RELEASECONFIRM setting: see T26756. */
- if (ELEM(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
+ /* If the initial event wasn't a drag event then
+ * ignore #USER_RELEASECONFIRM setting: see T26756. */
+ if ((ELEM(init_event_type, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) ||
+ init_event_val == KM_CLICK_DRAG) == 0) {
return 1;
}
}
}
else {
- /* this is fine as long as not doing km-release, otherwise
- * some items (i.e. markers) being tweaked may end up getting
- * dropped all over
- */
+ /* This is fine as long as not doing km-release, otherwise some items (i.e. markers)
+ * being tweaked may end up getting dropped all over. */
if (event->val != KM_RELEASE) {
return 1;
}