Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Show First 20 Lines • Show All 3,049 Lines • ▼ Show 20 Lines | else if (handler_base->poll == NULL || handler_base->poll(CTX_wm_region(C), event)) { | ||||
| wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; | wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base; | ||||
| if (!wm->is_interface_locked && event->type == EVT_DROP) { | if (!wm->is_interface_locked && event->type == EVT_DROP) { | ||||
| LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) { | LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) { | ||||
| /* Other drop custom types allowed. */ | /* Other drop custom types allowed. */ | ||||
| if (event->custom == EVT_DATA_DRAGDROP) { | if (event->custom == EVT_DATA_DRAGDROP) { | ||||
| ListBase *lb = (ListBase *)event->customdata; | ListBase *lb = (ListBase *)event->customdata; | ||||
| LISTBASE_FOREACH_MUTABLE (wmDrag *, drag, lb) { | LISTBASE_FOREACH_MUTABLE (wmDrag *, drag, lb) { | ||||
| if (drop->poll(C, drag, event)) { | if (drop->poll(C, drag, event)) { | ||||
| /* Optionally copy drag information to operator properties. Don't call it if the | wm_drop_prepare(C, drag, drop); | ||||
| * operator fails anyway, it might do more than just set properties (e.g. | |||||
| * typically import an asset). */ | |||||
| if (drop->copy && WM_operator_poll_context(C, drop->ot, drop->opcontext)) { | |||||
| drop->copy(drag, drop); | |||||
| } | |||||
| /* Pass single matched wmDrag onto the operator. */ | /* Pass single matched wmDrag onto the operator. */ | ||||
| BLI_remlink(lb, drag); | BLI_remlink(lb, drag); | ||||
| ListBase single_lb = {0}; | ListBase single_lb = {0}; | ||||
| BLI_addtail(&single_lb, drag); | BLI_addtail(&single_lb, drag); | ||||
| event->customdata = &single_lb; | event->customdata = &single_lb; | ||||
| int op_retval = wm_operator_call_internal( | int op_retval = wm_operator_call_internal( | ||||
| Show All 17 Lines | else if (handler_base->poll == NULL || handler_base->poll(CTX_wm_region(C), event)) { | ||||
| if (CTX_wm_window(C) == NULL) { | if (CTX_wm_window(C) == NULL) { | ||||
| return action; | return action; | ||||
| } | } | ||||
| /* Escape from drag loop, got freed. */ | /* Escape from drag loop, got freed. */ | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Always exit all drags on a drop event, even if poll didn't succeed. */ | |||||
| wm_drags_exit(wm, win); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (handler_base->type == WM_HANDLER_TYPE_GIZMO) { | else if (handler_base->type == WM_HANDLER_TYPE_GIZMO) { | ||||
| wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base; | wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base; | ||||
| action |= wm_handlers_do_gizmo_handler(C, wm, handler, event, handlers, do_debug_handler); | action |= wm_handlers_do_gizmo_handler(C, wm, handler, event, handlers, do_debug_handler); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | static void wm_event_drag_and_drop_test(wmWindowManager *wm, wmWindow *win, wmEvent *event) | ||||
| if (BLI_listbase_is_empty(&wm->drags)) { | if (BLI_listbase_is_empty(&wm->drags)) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) { | if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) { | ||||
| screen->do_draw_drag = true; | screen->do_draw_drag = true; | ||||
| } | } | ||||
| else if (event->type == EVT_ESCKEY) { | else if (event->type == EVT_ESCKEY) { | ||||
| wm_drags_exit(wm, win); | |||||
| WM_drag_free_list(&wm->drags); | WM_drag_free_list(&wm->drags); | ||||
| screen->do_draw_drag = true; | screen->do_draw_drag = true; | ||||
| } | } | ||||
| else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | ||||
| event->type = EVT_DROP; | event->type = EVT_DROP; | ||||
| /* Create customdata, first free existing. */ | /* Create customdata, first free existing. */ | ||||
| ▲ Show 20 Lines • Show All 2,227 Lines • Show Last 20 Lines | |||||