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 <campbell@blender.org>2022-03-02 06:44:34 +0300
committerCampbell Barton <campbell@blender.org>2022-03-02 06:44:34 +0300
commit78372d8b9ca2e923945a009166b9bc04f74ddadf (patch)
treefa0c464b122fcbb24a706e896154004c816450bc /source/blender/windowmanager/intern/wm_event_query.c
parentaa71414dfca7f301e101cce3e72551e7529290ea (diff)
Event System: support "Release Confirms" for click-drag events
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_query.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_query.c27
1 files changed, 15 insertions, 12 deletions
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;
}