diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-20 02:05:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-20 02:05:40 +0300 |
commit | 079099e8db65963393b75d2ae1705932819813e9 (patch) | |
tree | 6e826498ed8fdba58b7c98511c04516200423e0a /source | |
parent | 4d83507f3979871e0d5ea5ddff8cd833b1cc7d8d (diff) |
Cleanup: rename generic handler -> handler_base
Avoids having type specific handler names.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index efe8e269404..605d4fc24cc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2343,7 +2343,6 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers #define PRINT if (do_debug_handler) printf wmWindowManager *wm = CTX_wm_manager(C); - wmEventHandler *handler, *nexthandler; int action = WM_HANDLER_CONTINUE; int always_pass; @@ -2357,26 +2356,29 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers * by the event that's called, for eg: * * Calling a python script which changes the area.type, see [#32232] */ - for (handler = handlers->first; handler && handlers->first; handler = nexthandler) { - - nexthandler = handler->next; + for (wmEventHandler *handler_base = handlers->first, *handler_base_next; + handler_base && handlers->first; + handler_base = handler_base_next) + { + handler_base_next = handler_base->next; /* during this loop, ui handlers for nested menus can tag multiple handlers free */ - if (handler->flag & WM_HANDLER_DO_FREE) { + if (handler_base->flag & WM_HANDLER_DO_FREE) { /* pass */ } - else if (handler_boundbox_test(handler, event)) { /* optional boundbox */ + else if (handler_boundbox_test(handler_base, event)) { /* optional boundbox */ /* in advance to avoid access to freed event on window close */ always_pass = wm_event_always_pass(event); - /* modal+blocking handler */ - if (handler->flag & WM_HANDLER_BLOCKING) + /* modal+blocking handler_base */ + if (handler_base->flag & WM_HANDLER_BLOCKING) { action |= WM_HANDLER_BREAK; + } /* Handle all types here. */ - if (handler->type == WM_HANDLER_TYPE_KEYMAP) { - wmEventHandler_Keymap *handler_km = (wmEventHandler_Keymap *)handler; - wmKeyMap *keymap = WM_keymap_active(wm, handler_km->keymap); + if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) { + wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base; + wmKeyMap *keymap = WM_keymap_active(wm, handler->keymap); wmKeyMapItem *kmi; PRINT("%s: checking '%s' ...", __func__, keymap->idname); @@ -2387,17 +2389,17 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers for (kmi = keymap->items.first; kmi; kmi = kmi->next) { if (wm_eventmatch(event, kmi)) { - struct wmEventHandler_KeymapFn keymap_callback = handler_km->keymap_callback; + struct wmEventHandler_KeymapFn keymap_callback = handler->keymap_callback; PRINT("%s: item matched '%s'\n", __func__, kmi->idname); /* weak, but allows interactive callback to not use rawkey */ event->keymap_idname = kmi->idname; - action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr); + action |= wm_handler_operator_call(C, handlers, handler_base, event, kmi->ptr); if (action & WM_HANDLER_BREAK) { - /* not always_pass here, it denotes removed handler */ + /* not always_pass here, it denotes removed handler_base */ CLOG_INFO(WM_LOG_HANDLERS, 2, "handled! '%s'", kmi->idname); if (keymap_callback.handle_post_fn != NULL) { keymap_callback.handle_post_fn(keymap, kmi, keymap_callback.user_data); @@ -2419,17 +2421,17 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers PRINT("fail\n"); } } - else if (handler->type == WM_HANDLER_TYPE_UI) { - wmEventHandler_UI *handler_ui = (wmEventHandler_UI *)handler; - BLI_assert(handler_ui->handle_fn != NULL); + else if (handler_base->type == WM_HANDLER_TYPE_UI) { + wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base; + BLI_assert(handler->handle_fn != NULL); if (!wm->is_interface_locked) { - action |= wm_handler_ui_call(C, handler_ui, event, always_pass); + action |= wm_handler_ui_call(C, handler, event, always_pass); } } - else if (handler->type == WM_HANDLER_TYPE_DROPBOX) { - wmEventHandler_Dropbox *handler_db = (wmEventHandler_Dropbox *)handler; + else if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) { + wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; if (!wm->is_interface_locked && event->type == EVT_DROP) { - wmDropBox *drop = handler_db->dropboxes->first; + wmDropBox *drop = handler->dropboxes->first; for (; drop; drop = drop->next) { /* other drop custom types allowed */ if (event->custom == EVT_DATA_DRAGDROP) { @@ -2471,19 +2473,19 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers } } } - else if (handler->type == WM_HANDLER_TYPE_GIZMO) { - wmEventHandler_Gizmo *handler_gz = (wmEventHandler_Gizmo *)handler; + else if (handler_base->type == WM_HANDLER_TYPE_GIZMO) { + wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base; ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - wmGizmoMap *gzmap = handler_gz->gizmo_map; + wmGizmoMap *gzmap = handler->gizmo_map; BLI_assert(gzmap != NULL); wmGizmo *gz = wm_gizmomap_highlight_get(gzmap); - if (region->gizmo_map != handler_gz->gizmo_map) { - WM_gizmomap_tag_refresh(handler_gz->gizmo_map); + if (region->gizmo_map != handler->gizmo_map) { + WM_gizmomap_tag_refresh(handler->gizmo_map); } - wm_gizmomap_handler_context_gizmo(C, handler_gz); + wm_gizmomap_handler_context_gizmo(C, handler); wm_region_mouse_co(C, event); /* handle gizmo highlighting */ @@ -2555,7 +2557,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers CTX_wm_gizmo_group_set(C, gzgroup); /* handler->op is called later, we want keymap op to be triggered here */ - action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr); + action |= wm_handler_operator_call(C, handlers, handler_base, event, kmi->ptr); CTX_wm_gizmo_group_set(C, NULL); @@ -2599,16 +2601,16 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); } - else if (handler->type == WM_HANDLER_TYPE_OP) { - wmEventHandler_Op *handler_op = (wmEventHandler_Op *)handler; - if (handler_op->is_fileselect) { + else if (handler_base->type == WM_HANDLER_TYPE_OP) { + wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; + if (handler->is_fileselect) { if (!wm->is_interface_locked) { /* screen context changes here */ - action |= wm_handler_fileselect_call(C, handlers, handler_op, event); + action |= wm_handler_fileselect_call(C, handlers, handler, event); } } else { - action |= wm_handler_operator_call(C, handlers, handler, event, NULL); + action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL); } } else { @@ -2633,10 +2635,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers /* XXX code this for all modal ops, and ensure free only happens here */ /* modal ui handler can be tagged to be freed */ - if (BLI_findindex(handlers, handler) != -1) { /* could be freed already by regular modal ops */ - if (handler->flag & WM_HANDLER_DO_FREE) { - BLI_remlink(handlers, handler); - wm_event_free_handler(handler); + if (BLI_findindex(handlers, handler_base) != -1) { /* could be freed already by regular modal ops */ + if (handler_base->flag & WM_HANDLER_DO_FREE) { + BLI_remlink(handlers, handler_base); + wm_event_free_handler(handler_base); } } } |