diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_dragdrop.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index b1a469d1365..373360c7b92 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -74,9 +74,7 @@ typedef struct wmDropBoxMap { /* spaceid/regionid is zero for window drop maps */ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid) { - wmDropBoxMap *dm; - - for (dm = dropboxes.first; dm; dm = dm->next) { + LISTBASE_FOREACH (wmDropBoxMap *, dm, &dropboxes) { if (dm->spaceid == spaceid && dm->regionid == regionid) { if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME)) { return &dm->dropboxes; @@ -84,7 +82,7 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid) } } - dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list"); + wmDropBoxMap *dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list"); BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME); dm->spaceid = spaceid; dm->regionid = regionid; @@ -99,7 +97,6 @@ wmDropBox *WM_dropbox_add(ListBase *lb, void (*copy)(wmDrag *, wmDropBox *)) { wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox"); - drop->poll = poll; drop->copy = copy; drop->ot = WM_operatortype_find(idname, 0); @@ -119,12 +116,9 @@ wmDropBox *WM_dropbox_add(ListBase *lb, void wm_dropbox_free(void) { - wmDropBoxMap *dm; - - for (dm = dropboxes.first; dm; dm = dm->next) { - wmDropBox *drop; - for (drop = dm->dropboxes.first; drop; drop = drop->next) { + LISTBASE_FOREACH (wmDropBoxMap *, dm, &dropboxes) { + LISTBASE_FOREACH (wmDropBox *, drop, &dm->dropboxes) { if (drop->ptr) { WM_operator_properties_free(drop->ptr); MEM_freeN(drop->ptr); @@ -277,9 +271,8 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e void wm_drags_check_ops(bContext *C, const wmEvent *event) { wmWindowManager *wm = CTX_wm_manager(C); - wmDrag *drag; - for (drag = wm->drags.first; drag; drag = drag->next) { + LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) { wm_drop_operator_options(C, drag, event); } } @@ -389,12 +382,10 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; wmWindowManager *wm = CTX_wm_manager(C); - wmDrag *drag; const int winsize_y = WM_window_pixels_y(win); - int cursorx, cursory, x, y; - cursorx = win->eventstate->x; - cursory = win->eventstate->y; + int cursorx = win->eventstate->x; + int cursory = win->eventstate->y; if (rect) { rect->xmin = rect->xmax = cursorx; rect->ymin = rect->ymax = cursory; @@ -402,12 +393,13 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) /* Should we support multi-line drag draws? Maybe not, more types mixed wont work well. */ GPU_blend(GPU_BLEND_ALPHA); - for (drag = wm->drags.first; drag; drag = drag->next) { + LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) { const uchar text_col[] = {255, 255, 255, 255}; int iconsize = UI_DPI_ICON_SIZE; int padding = 4 * UI_DPI_FAC; /* image or icon */ + int x, y; if (drag->imb) { x = cursorx - drag->sx / 2; y = cursory - drag->sy / 2; |