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-11 14:49:47 +0300
committerCampbell Barton <campbell@blender.org>2022-03-11 14:49:47 +0300
commit789b1617f70e07f1c9bcb5253f1233acacbf6c8a (patch)
treef8a67aab8e67b7b7a8a49e28416f0b0b647f1449 /source/blender/windowmanager/WM_api.h
parente20fe187066cfb9b1847e656f0f9cef5c5bf7e73 (diff)
Fix out of order event handling when calling operators from gizmos
Activating a gizmo used the windows eventstate which may have values newer than the event used to activate the gizmo. This meant transforms check for the key that activated transform could be incorrect. Support passing an event when calling operators to avoid this problem.
Diffstat (limited to 'source/blender/windowmanager/WM_api.h')
-rw-r--r--source/blender/windowmanager/WM_api.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2f9062959c7..7959c3d6f0b 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -646,19 +646,29 @@ bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op
bool WM_operator_name_poll(struct bContext *C, const char *opstring);
/**
* Invokes operator in context.
+ *
+ * \param event: Optionally pass in an event to use when context uses one of the
+ * `WM_OP_INVOKE_*` values. When left unset the #wmWindow.eventstate will be used,
+ * this can cause problems for operators that read the events type - for example,
+ * storing the key that was pressed so as to be able to detect it's release.
+ * In these cases it's necessary to forward the current event being handled.
*/
int WM_operator_name_call_ptr(struct bContext *C,
struct wmOperatorType *ot,
wmOperatorCallContext context,
- struct PointerRNA *properties);
+ struct PointerRNA *properties,
+ const wmEvent *event);
+/** See #WM_operator_name_call_ptr */
int WM_operator_name_call(struct bContext *C,
const char *opstring,
wmOperatorCallContext context,
- struct PointerRNA *properties);
+ struct PointerRNA *properties,
+ const wmEvent *event);
int WM_operator_name_call_with_properties(struct bContext *C,
const char *opstring,
wmOperatorCallContext context,
- struct IDProperty *properties);
+ struct IDProperty *properties,
+ const wmEvent *event);
/**
* Similar to #WM_operator_name_call called with #WM_OP_EXEC_DEFAULT context.
*
@@ -677,6 +687,7 @@ void WM_operator_name_call_ptr_with_depends_on_cursor(struct bContext *C,
wmOperatorType *ot,
wmOperatorCallContext opcontext,
PointerRNA *properties,
+ const wmEvent *event,
const char *drawstr);
/**