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:
authorMartin Poirier <theeth@yahoo.com>2009-11-29 19:49:26 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-29 19:49:26 +0300
commitae16f465738b538964e5f00c1506582d47ead7d1 (patch)
tree6609ad15de8a7f2021be22e3d260ec88376aee5b /source/blender/windowmanager
parent3b72584b7dd71737099184bc5a981874a7b4fa21 (diff)
Fix CLICK event for modal operators.
modal operators should return RUNNING_MODAL|PASSTHROUGH for unhandled events to be able to receive clicks correctly (this needs to be fixed for other modal operators). Maybe it's time to have "handled" flag in event instead.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c18
-rw-r--r--source/blender/windowmanager/wm_event_system.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 8e83ceceab0..93c8b669611 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -941,6 +941,10 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH))
return WM_HANDLER_HANDLED;
+ /* Modal unhandled, break */
+ if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL))
+ return (WM_HANDLER_BREAK|WM_HANDLER_MODAL);
+
if(retval & OPERATOR_PASS_THROUGH)
return WM_HANDLER_CONTINUE;
@@ -1159,7 +1163,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
/* test for CLICK event */
- if (event->val == KM_RELEASE && action == WM_HANDLER_CONTINUE) {
+ if (event->val == KM_RELEASE && (action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL))) {
wmWindow *win = CTX_wm_window(C);
if (win && win->last_type == event->type && win->last_val == KM_PRESS) {
@@ -1354,15 +1358,15 @@ void wm_event_do_handlers(bContext *C)
}
/* store last event for this window */
- if (action == WM_HANDLER_CONTINUE) {
- /* mousemove event don't overwrite last type */
- if (event->type != MOUSEMOVE) {
+ /* mousemove event don't overwrite last type */
+ if (event->type != MOUSEMOVE) {
+ if (action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL)) {
win->last_type = event->type;
win->last_val = event->val;
+ } else {
+ win->last_type = -1;
+ win->last_val = 0;
}
- } else {
- win->last_type = -1;
- win->last_val = 0;
}
/* unlink and free here, blender-quit then frees all */
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 78655a9fcd3..3d7cb3fbad1 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -32,6 +32,7 @@
#define WM_HANDLER_CONTINUE 0
#define WM_HANDLER_BREAK 1
#define WM_HANDLER_HANDLED 2
+#define WM_HANDLER_MODAL 4 /* MODAL|BREAK means unhandled */
struct ScrArea;
struct ARegion;