diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-20 01:56:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-20 01:57:38 +0300 |
commit | 4d83507f3979871e0d5ea5ddff8cd833b1cc7d8d (patch) | |
tree | 328992569cce5137a55d6174acf63101615683c0 /source | |
parent | 63d77d6d27385579420595c4131c7f0fd61b3f69 (diff) |
Cleanup: simplify handler type conditional
Each handler type now has it's own block (fileselect was an exception).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index e1e53ed5f12..efe8e269404 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2373,6 +2373,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers if (handler->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); @@ -2425,15 +2426,6 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers action |= wm_handler_ui_call(C, handler_ui, event, always_pass); } } - else if ((handler->type == WM_HANDLER_TYPE_OP) && - ((wmEventHandler_Op *)handler)->is_fileselect) - { - wmEventHandler_Op *handler_op = (wmEventHandler_Op *)handler; - if (!wm->is_interface_locked) { - /* screen context changes here */ - action |= wm_handler_fileselect_call(C, handlers, handler_op, event); - } - } else if (handler->type == WM_HANDLER_TYPE_DROPBOX) { wmEventHandler_Dropbox *handler_db = (wmEventHandler_Dropbox *)handler; if (!wm->is_interface_locked && event->type == EVT_DROP) { @@ -2607,9 +2599,21 @@ 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) { + if (!wm->is_interface_locked) { + /* screen context changes here */ + action |= wm_handler_fileselect_call(C, handlers, handler_op, event); + } + } + else { + action |= wm_handler_operator_call(C, handlers, handler, event, NULL); + } + } else { - /* modal, swallows all */ - action |= wm_handler_operator_call(C, handlers, handler, event, NULL); + /* Unreachable (handle all types above). */ + BLI_assert(0); } if (action & WM_HANDLER_BREAK) { |