Cleanup: simplify handler type conditional

Each handler type now has it's own block (fileselect was an exception).
This commit is contained in:
Campbell Barton 2019-02-20 09:56:18 +11:00
parent 63d77d6d27
commit 4d83507f39
1 changed files with 15 additions and 11 deletions

View File

@ -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) {