Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_event_system.c
| Context not available. | |||||
| 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) { | ||||
| event->is_repeat = 0; // repurposed to indicate index of file of a drag-drop | |||||
ISS: Use C-style comments, see https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments | |||||
| ListBase *lb = (ListBase *)event->customdata; | ListBase *lb = (ListBase *)event->customdata; | ||||
| LISTBASE_FOREACH (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 | /* Optionally copy drag information to operator properties. Don't call it if the | ||||
| * operator fails anyway, it might do more than just set properties (e.g. | * operator fails anyway, it might do more than just set properties (e.g. | ||||
| Context not available. | |||||
| /* 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 = {drag, drag}; | ListBase single_lb = {NULL, NULL}; | ||||
| BLI_addhead(&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( | ||||
| Context not available. | |||||
| if ((op_retval & OPERATOR_CANCELLED) && drop->cancel) { | if ((op_retval & OPERATOR_CANCELLED) && drop->cancel) { | ||||
| drop->cancel(CTX_data_main(C), drag, drop); | drop->cancel(CTX_data_main(C), drag, drop); | ||||
| action |= WM_HANDLER_BREAK; | |||||
| } | } | ||||
| action |= WM_HANDLER_BREAK; | /* Free this drag. */ | ||||
| WM_drag_free(drag); | |||||
| /* Free the drags. */ | // increment file index; | ||||
| WM_drag_free_list(lb); | ++event->is_repeat; | ||||
campbellbartonUnsubmitted Not Done Inline ActionsUsing is_repeat isn't reliable, this is intended to be a boolean, where as it's used as an integer which will wrap back to zero after 255 items. If this is used at all it could be set to true. campbellbarton: Using `is_repeat` isn't reliable, this is intended to be a boolean, where as it's used as an… | |||||
| WM_drag_free_list(&single_lb); | } | ||||
| } | |||||
| event->customdata = NULL; | |||||
| event->custom = 0; | |||||
| /* XXX fileread case. */ | |||||
| if (CTX_wm_window(C) == NULL) { | |||||
| return action; | |||||
| } | |||||
| /* Escape from drag loop, got freed. */ | event->is_repeat = 0; | ||||
| break; | event->customdata = lb; | ||||
| if ((action & WM_HANDLER_BREAK) || BLI_listbase_is_empty(lb)) { | |||||
| event->customdata = NULL; | |||||
| event->custom = 0; | |||||
| /* Free the drags. */ | |||||
| WM_drag_free_list(lb); | |||||
| /* XXX fileread case. */ | |||||
| if (CTX_wm_window(C) == NULL) { | |||||
| return action; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
Use C-style comments, see https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments