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/blenloader/intern/readfile.c1
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c4
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_regions.c8
-rw-r--r--source/blender/editors/interface/view2d_ops.c6
-rw-r--r--source/blender/editors/mesh/loopcut.c4
-rw-r--r--source/blender/editors/physics/editparticle.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c8
-rw-r--r--source/blender/editors/space_node/node_edit.c4
-rw-r--r--source/blender/editors/space_text/text_ops.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c6
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c2
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h3
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c77
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c1
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c10
-rw-r--r--source/blender/windowmanager/intern/wm_window.c1
28 files changed, 106 insertions, 83 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0cbbc1051e7..c5dcf1ce520 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4371,6 +4371,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
win->timers.first= win->timers.last= NULL;
win->queue.first= win->queue.last= NULL;
win->handlers.first= win->handlers.last= NULL;
+ win->modalhandlers.first= win->modalhandlers.last= NULL;
win->subwindows.first= win->subwindows.last= NULL;
win->gesture.first= win->gesture.last= NULL;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 06fa3b715e0..bed534ae070 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -458,7 +458,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
mm->event_type= evt->type;
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
/* reset frs delta */
RNA_int_set(op->ptr, "frames", 0);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 186bdc3b762..80077a6d4b3 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -162,7 +162,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
change_frame_apply(C, op);
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 79d3d7b1366..1e416d9c31d 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -2618,7 +2618,7 @@ static int sketch_draw_stroke(bContext *C, wmOperator *op, wmEvent *event)
sk_draw_stroke(C, sketch, sketch->active_stroke, dd, snap);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -2644,7 +2644,7 @@ static int sketch_draw_gesture(bContext *C, wmOperator *op, wmEvent *event)
sk_start_draw_gesture(sketch);
sk_draw_stroke(C, sketch, sketch->gesture, dd, snap);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index c332a297e57..f072f2e980e 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -1411,7 +1411,7 @@ static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event)
poselib_preview_apply(C, op);
/* add temp handler if we're running as a modal operator */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 99b85d62026..92ae2400666 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1341,7 +1341,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
}
/* add a modal handler for this operator, so that we can then draw continuous strokes */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 246058ceacc..e8d813d8ff9 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3660,11 +3660,11 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
if(!(but->block->handle && but->block->handle->popup)) {
if(button_modal_state(state)) {
if(!button_modal_state(data->state))
- WM_event_add_ui_handler(C, &data->window->handlers, ui_handler_region_menu, NULL, data);
+ WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data);
}
else {
if(button_modal_state(data->state))
- WM_event_remove_ui_handler(&data->window->handlers, ui_handler_region_menu, NULL, data);
+ WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data);
}
}
@@ -4600,7 +4600,7 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
uiPopupBlockHandle temp= *menu;
ui_popup_block_free(C, menu);
- WM_event_remove_ui_handler(&CTX_wm_window(C)->handlers, ui_handler_popup, ui_handler_remove_popup, menu);
+ WM_event_remove_ui_handler(&CTX_wm_window(C)->modalhandlers, ui_handler_popup, ui_handler_remove_popup, menu);
if(temp.menuretval == UI_RETURN_OK) {
if(temp.popup_func)
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 776122380bf..cf29a1ddb58 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1400,14 +1400,14 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
MEM_freeN(data);
pa->activedata= NULL;
- WM_event_remove_ui_handler(&win->handlers, ui_handler_panel, ui_handler_remove_panel, pa);
+ WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa);
}
else {
if(!data) {
data= MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
pa->activedata= data;
- WM_event_add_ui_handler(C, &win->handlers, ui_handler_panel, ui_handler_remove_panel, pa);
+ WM_event_add_ui_handler(C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa);
}
if(ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 95305819e2b..065d391e6d6 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2275,7 +2275,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
if(!but) {
handle->popup= 1;
- UI_add_popup_handlers(C, &window->handlers, handle);
+ UI_add_popup_handlers(C, &window->modalhandlers, handle);
WM_event_add_mousemove(C);
}
@@ -2332,7 +2332,7 @@ void uiPupMenuEnd(bContext *C, uiPopupMenu *pup)
menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPUP, pup);
menu->popup= 1;
- UI_add_popup_handlers(C, &window->handlers, menu);
+ UI_add_popup_handlers(C, &window->modalhandlers, menu);
WM_event_add_mousemove(C);
MEM_freeN(pup);
@@ -2493,7 +2493,7 @@ void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, char *opname, i
handle->optype= (opname)? WM_operatortype_find(opname, 0): NULL;
handle->opcontext= opcontext;
- UI_add_popup_handlers(C, &window->handlers, handle);
+ UI_add_popup_handlers(C, &window->modalhandlers, handle);
WM_event_add_mousemove(C);
}
@@ -2516,7 +2516,7 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
handle->cancel_func= confirm_cancel_operator;
handle->opcontext= opcontext;
- UI_add_popup_handlers(C, &window->handlers, handle);
+ UI_add_popup_handlers(C, &window->modalhandlers, handle);
WM_event_add_mousemove(C);
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 33838418842..ae4fe4eed1b 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -210,7 +210,7 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_cursor_modal(window, BC_NSEW_SCROLLCURSOR);
/* add temp handler */
- WM_event_add_modal_handler(C, &window->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -764,7 +764,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_cursor_modal(window, BC_NSEW_SCROLLCURSOR);
/* add temp handler */
- WM_event_add_modal_handler(C, &window->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1292,7 +1292,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
/* still ok, so can add */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
else {
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index f83ab04d785..c322a169679 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -328,7 +328,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
/* add a modal handler for this operator - handles loop selection */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
lcd = op->customdata;
lcd->vc.mval[0] = evt->mval[0];
@@ -356,7 +356,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
/* add a modal handler for this operator - handles loop selection */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
lcd = op->customdata;
lcd->vc.mval[0] = evt->mval[0];
diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c
index cbfcf1508c7..a5e169eba06 100644
--- a/source/blender/editors/physics/editparticle.c
+++ b/source/blender/editors/physics/editparticle.c
@@ -3352,7 +3352,7 @@ static int brush_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
brush_edit_apply_event(C, op, event);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 605bd8682f5..6107d412323 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -456,7 +456,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
else {
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -588,7 +588,7 @@ static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* add modal handler */
WM_cursor_modal(CTX_wm_window(C), BC_SWAPAREA_CURSOR);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -870,7 +870,7 @@ static int area_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_PASS_THROUGH;
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1160,7 +1160,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
area_move_set_limits(CTX_wm_screen(C), dir, &sd->bigger, &sd->smaller);
/* add temp handler for edge move or cancel */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1296,7 +1296,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
rmd->origval= rmd->ar->type->minsizey;
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1749,7 +1749,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_PASS_THROUGH;
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -2944,7 +2944,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
/* add modal handler for ESC */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 0d83cef3e95..d3cd49a2658 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4764,7 +4764,7 @@ static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event)
paint_apply_event(C, op, event);
pop= op->customdata;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
if(pop->s.brush->flag & BRUSH_AIRBRUSH)
pop->timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER, 0.01f);
@@ -4966,7 +4966,7 @@ static int grab_clone_invoke(bContext *C, wmOperator *op, wmEvent *event)
cmv->starty= event->y;
op->customdata= cmv;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index c43d903d4a6..17fd1d4fa4a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1502,7 +1502,7 @@ static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event)
wpaint_stroke_done);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
op->type->modal(C, op, event);
@@ -1775,7 +1775,7 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event)
vpaint_stroke_done);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
op->type->modal(C, op, event);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 822e79bea1e..a466c87746b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1440,7 +1440,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
sculpt_stroke_done);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
op->type->modal(C, op, event);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index d54dd56d1e8..3491ccd9d20 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -161,7 +161,7 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->xof= sima->xof;
vpd->yof= sima->yof;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
}
static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
@@ -280,7 +280,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->y= event->y;
vpd->zoom= sima->zoom;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
}
static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
@@ -1453,7 +1453,7 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
sample_apply(C, op, event);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1621,7 +1621,7 @@ static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *event)
rcd= op->customdata;
rcd->timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER, 0.0f);
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
if(!record_composite_apply(C, op))
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 4fd6995b8fd..5fc09408229 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1216,7 +1216,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
nsw->oldwidth= node->width;
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -2033,7 +2033,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
nldrag->link= nodeAddLink(snode->edittree, NULL, NULL, nldrag->node, nldrag->sock);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 3568f50dfe1..8e81336912b 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1731,7 +1731,7 @@ static int scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
st->flags|= ST_SCROLL_SELECT;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -1860,7 +1860,7 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
st->flags|= ST_SCROLL_SELECT;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -2115,7 +2115,7 @@ static int set_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
scu->sell= txt_get_span(st->text->lines.first, st->text->sell);
scu->selc= st->text->selc;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
set_cursor_apply(C, op, event);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index bbcee0415f8..d28789491dd 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -541,7 +541,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -625,7 +625,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
viewops_data(C, op, event);
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -823,7 +823,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
viewops_data(C, op, event);
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 7dfae33bc39..f9597b81114 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -270,7 +270,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
TransInfo *t = op->customdata;
/* add temp handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
t->flag |= T_MODAL; // XXX meh maybe somewhere else
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index ccdc51430bc..b848bd4fb09 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -342,7 +342,7 @@ static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *event)
minimize_stretch_iteration(C, op, 1);
ms= op->customdata;
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
ms->timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER, 0.01f);
return OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 00fbc04844c..67a6b3153e4 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -162,7 +162,8 @@ typedef struct wmWindow {
ListBase timers;
ListBase queue; /* all events (ghost level events were handled) */
- ListBase handlers; /* window+screen handlers, overriding all queues */
+ ListBase handlers; /* window+screen handlers, handled last */
+ ListBase modalhandlers; /* modal handlers, overriding all queues */
ListBase subwindows; /* opengl stuff for sub windows, see notes in wm_subwindow.c */
ListBase gesture; /* gesture stuff */
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b2edbc324ea..a757deb4a8a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -119,7 +119,7 @@ void WM_event_remove_ui_handler(ListBase *handlers,
int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
void (*remove)(struct bContext *C, void *userdata), void *userdata);
-struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, ListBase *handlers, struct wmOperator *op);
+struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
void WM_event_add_mousemove(struct bContext *C);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 22c5788b0ae..2a2e0141381 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1024,7 +1024,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
event->keymap_idname= kmi->idname; /* weak, but allows interactive callback to not use rawkey */
action= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
- if(action==WM_HANDLER_BREAK) /* not wm_event_always_pass(event) here, it denotes removed handler */
+ if(action==WM_HANDLER_BREAK) /* not always_pass here, it denotes removed handler */
break;
}
}
@@ -1042,8 +1042,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
action= wm_handler_operator_call(C, handlers, handler, event, NULL);
}
- if(!always_pass && action==WM_HANDLER_BREAK)
- break;
+ if(action==WM_HANDLER_BREAK) {
+ if(always_pass)
+ action= WM_HANDLER_CONTINUE;
+ else
+ break;
+ }
}
/* fileread case */
@@ -1055,6 +1059,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
static int wm_event_inside_i(wmEvent *event, rcti *rect)
{
+ if(wm_event_always_pass(event))
+ return 1;
if(BLI_in_rcti(rect, event->x, event->y))
return 1;
if(event->type==MOUSEMOVE) {
@@ -1156,58 +1162,70 @@ void wm_event_do_handlers(bContext *C)
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
wm_window_make_drawable(C, win);
- action= wm_handlers_do(C, event, &win->handlers);
+ /* first we do modal handlers */
+ action= wm_handlers_do(C, event, &win->modalhandlers);
/* fileread case */
- if(CTX_wm_window(C)==NULL) {
+ if(CTX_wm_window(C)==NULL)
return;
- }
/* builtin tweak, if action is break it removes tweak */
- if(!wm_event_always_pass(event))
- wm_tweakevent_test(C, event, action);
+ wm_tweakevent_test(C, event, action);
- if(wm_event_always_pass(event) || action==WM_HANDLER_CONTINUE) {
+ if(action==WM_HANDLER_CONTINUE) {
ScrArea *sa;
ARegion *ar;
int doit= 0;
/* XXX to solve, here screen handlers? */
- if(!wm_event_always_pass(event)) {
- if(event->type==MOUSEMOVE) {
- /* state variables in screen, cursors */
- ED_screen_set_subwinactive(win, event);
- /* for regions having custom cursors */
- wm_paintcursor_test(C, event);
- }
+ if(event->type==MOUSEMOVE) {
+ /* state variables in screen, cursors */
+ ED_screen_set_subwinactive(win, event);
+ /* for regions having custom cursors */
+ wm_paintcursor_test(C, event);
}
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(wm_event_always_pass(event) || wm_event_inside_i(event, &sa->totrct)) {
-
+ if(wm_event_inside_i(event, &sa->totrct)) {
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, NULL);
- action= wm_handlers_do(C, event, &sa->handlers);
- if(wm_event_always_pass(event) || action==WM_HANDLER_CONTINUE) {
+ if(action==WM_HANDLER_CONTINUE) {
for(ar=sa->regionbase.first; ar; ar= ar->next) {
- if(wm_event_always_pass(event) || wm_event_inside_i(event, &ar->winrct)) {
+ if(wm_event_inside_i(event, &ar->winrct)) {
CTX_wm_region_set(C, ar);
action= wm_handlers_do(C, event, &ar->handlers);
doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
- if(!wm_event_always_pass(event)) {
- if(action==WM_HANDLER_BREAK)
- break;
- }
+ if(action==WM_HANDLER_BREAK)
+ break;
}
}
}
+
+ CTX_wm_region_set(C, NULL);
+
+ if(action==WM_HANDLER_CONTINUE)
+ action= wm_handlers_do(C, event, &sa->handlers);
+
+ CTX_wm_area_set(C, NULL);
+
/* NOTE: do not escape on WM_HANDLER_BREAK, mousemove needs handled for previous area */
}
}
+ if(action==WM_HANDLER_CONTINUE) {
+ /* also some non-modal handlers need active area/region */
+ CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
+ CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+
+ action= wm_handlers_do(C, event, &win->handlers);
+
+ /* fileread case */
+ if(CTX_wm_window(C)==NULL)
+ return;
+ }
+
/* XXX hrmf, this gives reliable previous mouse coord for area change, feels bad?
doing it on ghost queue gives errors when mousemoves go over area borders */
if(doit && win->screen->subwinactive != win->screen->mainwin) {
@@ -1274,7 +1292,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
handler->op_region= CTX_wm_region(C);
handler->filescreen= CTX_wm_screen(C);
- BLI_addhead(&win->handlers, handler);
+ BLI_addhead(&win->modalhandlers, handler);
WM_event_fileselect_event(C, op, full?EVT_FILESELECT_FULL_OPEN:EVT_FILESELECT_OPEN);
}
@@ -1285,9 +1303,10 @@ void WM_event_set_handler_flag(wmEventHandler *handler, int flag)
handler->flag= flag;
}
-wmEventHandler *WM_event_add_modal_handler(bContext *C, ListBase *handlers, wmOperator *op)
+wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
{
wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event modal handler");
+ wmWindow *win= CTX_wm_window(C);
/* operator was part of macro */
if(op->opm) {
@@ -1302,7 +1321,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, ListBase *handlers, wmOp
handler->op_area= CTX_wm_area(C); /* means frozen screen context for modal handlers! */
handler->op_region= CTX_wm_region(C);
- BLI_addhead(handlers, handler);
+ BLI_addhead(&win->modalhandlers, handler);
return handler;
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 9a268f8be17..5c78b32f3f8 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -186,6 +186,7 @@ void WM_exit(bContext *C)
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
+ WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
}
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 2e2d463bbd9..f31d62967ae 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1366,7 +1366,7 @@ int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
op->customdata= WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
wm_gesture_tag_redraw(C);
@@ -1430,7 +1430,7 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
op->customdata= WM_gesture_new(C, event, WM_GESTURE_CIRCLE);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
wm_gesture_tag_redraw(C);
@@ -1607,7 +1607,7 @@ int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
op->customdata= WM_gesture_new(C, event, WM_GESTURE_LASSO);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
wm_gesture_tag_redraw(C);
@@ -1622,7 +1622,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event)
op->customdata= WM_gesture_new(C, event, WM_GESTURE_LINES);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
wm_gesture_tag_redraw(C);
@@ -1929,7 +1929,7 @@ int WM_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
wm_radial_control_paint, op->customdata);
/* add modal handler */
- WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
+ WM_event_add_modal_handler(C, op);
WM_radial_control_modal(C, op, event);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index cbb5bed4c00..2eee11c6820 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -146,6 +146,7 @@ void wm_window_free(bContext *C, wmWindow *win)
CTX_wm_window_set(C, NULL);
WM_event_remove_handlers(C, &win->handlers);
+ WM_event_remove_handlers(C, &win->modalhandlers);
/* end running jobs, a job end also removes its timer */
for(wt= win->timers.first; wt; wt= wtnext) {