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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-28 18:52:20 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-28 19:15:45 +0400
commitdeab0d10402b59652ec5e19836856eb238af863e (patch)
tree8e57bf2f123b32152e043d008652d23899bacf19 /source/blender/windowmanager/intern
parent4683ac38864e9290bcd5b7f0f159481193a47756 (diff)
Fix T38381, Fix T38184: key events getting lost when modal operator is running.
There is a hack for modal keymaps and double click events, which was (ab)using the wmEvent.prevval variable to temporarily assign it KM_DBL_CLICK indicating that the double click event was disabled. However the value of prevval can actually be KM_DBL_CLICK in other circumstances too, which caused a key press event to get converted to a double click event.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 1256fcf70a2..9e271feca81 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1446,7 +1446,7 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
/* operator exists */
-static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *event)
+static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *event, bool *dbl_click_disabled)
{
/* support for modal keymap in macros */
if (op->opm)
@@ -1473,15 +1473,15 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
* handling typically swallows all events (OPERATOR_RUNNING_MODAL).
* This bypass just disables support for double clicks in hardcoded modal handlers */
if (event->val == KM_DBL_CLICK) {
- event->prevval = event->val;
event->val = KM_PRESS;
+ *dbl_click_disabled = true;
}
}
}
/* bad hacking event system... better restore event type for checking of KM_CLICK for example */
/* XXX modal maps could use different method (ton) */
-static void wm_event_modalmap_end(wmEvent *event)
+static void wm_event_modalmap_end(wmEvent *event, bool dbl_click_disabled)
{
if (event->type == EVT_MODAL_MAP) {
event->type = event->prevtype;
@@ -1489,7 +1489,7 @@ static void wm_event_modalmap_end(wmEvent *event)
event->val = event->prevval;
event->prevval = 0;
}
- else if (event->prevval == KM_DBL_CLICK)
+ else if (dbl_click_disabled)
event->val = KM_DBL_CLICK;
}
@@ -1510,10 +1510,11 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
-
+ bool dbl_click_disabled = false;
+
wm_handler_op_context(C, handler);
wm_region_mouse_co(C, event);
- wm_event_modalkeymap(C, op, event);
+ wm_event_modalkeymap(C, op, event, &dbl_click_disabled);
if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
@@ -1527,7 +1528,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
* the event, operator etc have all been freed. - campbell */
if (CTX_wm_manager(C) == wm) {
- wm_event_modalmap_end(event);
+ wm_event_modalmap_end(event, dbl_click_disabled);
if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth--;