Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | static int wm_operator_call_internal(bContext *C, | ||||
| PointerRNA *properties, | PointerRNA *properties, | ||||
| ReportList *reports, | ReportList *reports, | ||||
| const wmOperatorCallContext context, | const wmOperatorCallContext context, | ||||
| const bool poll_only, | const bool poll_only, | ||||
| const wmEvent *event); | const wmEvent *event); | ||||
| static bool wm_operator_check_locked_interface(bContext *C, wmOperatorType *ot); | static bool wm_operator_check_locked_interface(bContext *C, wmOperatorType *ot); | ||||
| static wmEvent *wm_event_add_mousemove_to_head(wmWindow *win); | static wmEvent *wm_event_add_mousemove_to_head(wmWindow *win); | ||||
| static void wm_operator_free_for_fileselect(wmOperator *file_operator); | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Event Management | /** \name Event Management | ||||
| * \{ */ | * \{ */ | ||||
| wmEvent *wm_event_add_ex(wmWindow *win, | wmEvent *wm_event_add_ex(wmWindow *win, | ||||
| const wmEvent *event_to_add, | const wmEvent *event_to_add, | ||||
| const wmEvent *event_to_add_after) | const wmEvent *event_to_add_after) | ||||
| ▲ Show 20 Lines • Show All 1,900 Lines • ▼ Show 20 Lines | if (handler_base->type == WM_HANDLER_TYPE_OP) { | ||||
| wm->op_undo_depth--; | wm->op_undo_depth--; | ||||
| } | } | ||||
| CTX_wm_area_set(C, area); | CTX_wm_area_set(C, area); | ||||
| CTX_wm_region_set(C, region); | CTX_wm_region_set(C, region); | ||||
| } | } | ||||
| WM_cursor_grab_disable(win, NULL); | WM_cursor_grab_disable(win, NULL); | ||||
| WM_operator_free(handler->op); | wm_operator_free_for_fileselect(handler->op); | ||||
| } | } | ||||
| } | } | ||||
| else if (handler_base->type == WM_HANDLER_TYPE_UI) { | else if (handler_base->type == WM_HANDLER_TYPE_UI) { | ||||
| wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base; | wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base; | ||||
| if (handler->remove_fn) { | if (handler->remove_fn) { | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| ▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Lines | static int wm_handler_operator_call(bContext *C, | ||||
| if (retval & OPERATOR_PASS_THROUGH) { | if (retval & OPERATOR_PASS_THROUGH) { | ||||
| return WM_HANDLER_CONTINUE; | return WM_HANDLER_CONTINUE; | ||||
| } | } | ||||
| return WM_HANDLER_BREAK; | return WM_HANDLER_BREAK; | ||||
| } | } | ||||
| static void wm_operator_free_for_fileselect(wmOperator *file_operator) | |||||
| { | |||||
| LISTBASE_FOREACH (bScreen *, screen, &G_MAIN->screens) { | |||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | |||||
| if (area->spacetype == SPACE_FILE) { | |||||
| SpaceFile *sfile = area->spacedata.first; | |||||
| if (sfile->op == file_operator) { | |||||
| sfile->op = NULL; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| WM_operator_free(file_operator); | |||||
| } | |||||
| /** | /** | ||||
| * File-select handlers are only in the window queue, | * File-select handlers are only in the window queue, | ||||
| * so it's safe to switch screens or area types. | * so it's safe to switch screens or area types. | ||||
| */ | */ | ||||
| static int wm_handler_fileselect_do(bContext *C, | static int wm_handler_fileselect_do(bContext *C, | ||||
| ListBase *handlers, | ListBase *handlers, | ||||
| wmEventHandler_Op *handler, | wmEventHandler_Op *handler, | ||||
| int val) | int val) | ||||
| ▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | case EVT_FILESELECT_EXTERNAL_CANCEL: { | ||||
| /* For #WM_operator_pystring only, custom report handling is done above. */ | /* For #WM_operator_pystring only, custom report handling is done above. */ | ||||
| wm_operator_reports(C, handler->op, retval, true); | wm_operator_reports(C, handler->op, retval, true); | ||||
| if (retval & OPERATOR_FINISHED) { | if (retval & OPERATOR_FINISHED) { | ||||
| WM_operator_last_properties_store(handler->op); | WM_operator_last_properties_store(handler->op); | ||||
| } | } | ||||
| if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { | if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { | ||||
| WM_operator_free(handler->op); | wm_operator_free_for_fileselect(handler->op); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (handler->op->type->cancel) { | if (handler->op->type->cancel) { | ||||
| if (handler->op->type->flag & OPTYPE_UNDO) { | if (handler->op->type->flag & OPTYPE_UNDO) { | ||||
| wm->op_undo_depth++; | wm->op_undo_depth++; | ||||
| } | } | ||||
| handler->op->type->cancel(C, handler->op); | handler->op->type->cancel(C, handler->op); | ||||
| if (handler->op->type->flag & OPTYPE_UNDO) { | if (handler->op->type->flag & OPTYPE_UNDO) { | ||||
| wm->op_undo_depth--; | wm->op_undo_depth--; | ||||
| } | } | ||||
| } | } | ||||
| wm_operator_free_for_fileselect(handler->op); | |||||
| WM_operator_free(handler->op); | |||||
| } | } | ||||
| CTX_wm_area_set(C, NULL); | CTX_wm_area_set(C, NULL); | ||||
| wm_event_free_handler(&handler->head); | wm_event_free_handler(&handler->head); | ||||
| action = WM_HANDLER_BREAK; | action = WM_HANDLER_BREAK; | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 3,158 Lines • Show Last 20 Lines | |||||