diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-19 07:18:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-19 08:17:21 +0300 |
commit | f88ea20285891d516c91c976239f95994f73abf3 (patch) | |
tree | ef07c2513dcfc688d9c6cdd2fa8aa2fdf8b98d32 /source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | |
parent | eae2942474fa06b369b3fc6ebdeddad90ca38d43 (diff) |
WM: move operator handler to it's own type
Diffstat (limited to 'source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c')
-rw-r--r-- | source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 8b6be7bb624..b1e35943b6c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -690,21 +690,21 @@ void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap) } void wm_gizmomaps_handled_modal_update( - bContext *C, wmEvent *event, wmEventHandler *handler) + bContext *C, wmEvent *event, wmEventHandler_Op *handler) { const bool modal_running = (handler->op != NULL); /* happens on render or when joining areas */ - if (!handler->op_region || !handler->op_region->gizmo_map) { + if (!handler->context.region || !handler->context.region->gizmo_map) { return; } - wmGizmoMap *gzmap = handler->op_region->gizmo_map; + wmGizmoMap *gzmap = handler->context.region->gizmo_map; wmGizmo *gz = wm_gizmomap_modal_get(gzmap); ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - wm_gizmomap_handler_context(C, handler); + wm_gizmomap_handler_context_op(C, handler); /* regular update for running operator */ if (modal_running) { @@ -830,41 +830,41 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action) * Prepare context for gizmo handling (but only if area/region is * part of screen). Version of #wm_handler_op_context for gizmos. */ -void wm_gizmomap_handler_context(bContext *C, wmEventHandler *handler) +void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler) { bScreen *screen = CTX_wm_screen(C); if (screen) { - if (handler->op_area == NULL) { - /* do nothing in this context */ + ScrArea *sa; + + for (sa = screen->areabase.first; sa; sa = sa->next) { + if (sa == handler->context.area) { + break; + } + } + if (sa == NULL) { + /* when changing screen layouts with running modal handlers (like render display), this + * is not an error to print */ + printf("internal error: modal gizmo-map handler has invalid area\n"); } else { - ScrArea *sa; - - for (sa = screen->areabase.first; sa; sa = sa->next) - if (sa == handler->op_area) + ARegion *ar; + CTX_wm_area_set(C, sa); + for (ar = sa->regionbase.first; ar; ar = ar->next) + if (ar == handler->context.region) break; - if (sa == NULL) { - /* when changing screen layouts with running modal handlers (like render display), this - * is not an error to print */ - if (handler->type != WM_HANDLER_TYPE_GIZMO) { - printf("internal error: modal gizmo-map handler has invalid area\n"); - } - } - else { - ARegion *ar; - CTX_wm_area_set(C, sa); - for (ar = sa->regionbase.first; ar; ar = ar->next) - if (ar == handler->op_region) - break; - /* XXX no warning print here, after full-area and back regions are remade */ - if (ar) - CTX_wm_region_set(C, ar); - } + /* XXX no warning print here, after full-area and back regions are remade */ + if (ar) + CTX_wm_region_set(C, ar); } } } +void wm_gizmomap_handler_context_gizmo(bContext *UNUSED(C), wmEventHandler_Gizmo *UNUSED(handler)) +{ + /* pass */ +} + bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win) { wmGizmo *gz = gzmap->gzmap_context.highlight; |