WM: window draw callbacks and split preview snap
authormano-wii <germano.costa@ig.com.br>
Fri, 19 Jan 2018 06:14:27 +0000 (17:14 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 19 Jan 2018 06:15:45 +0000 (17:15 +1100)
This moves window overlay from hard coded flags into drawing callbacks.

It also supports snapping (holding Ctrl).

source/blender/editors/include/ED_screen.h
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/makesdna/DNA_screen_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_draw.c

index 4253e214537d1270e27158d0fe064ff0f4d0de44..755aedf946d37893590ebac00c8232bf17317896 100644 (file)
@@ -98,7 +98,9 @@ int     ED_area_headersize(void);
 
 /* screens */
 void    ED_screens_initialize(struct wmWindowManager *wm);
-void    ED_screen_draw(struct wmWindow *win);
+void    ED_screen_draw_edges(struct wmWindow *win);
+void    ED_screen_draw_join_shape(struct ScrArea *sa1, struct ScrArea *sa2);
+void    ED_screen_draw_split_preview(struct ScrArea *sa, const int dir, const float fac);
 void    ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win);
 void    ED_screen_do_listen(struct bContext *C, struct wmNotifier *note);
 bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc);
index 8f1132dc1e57cf2a0342206be0ff7e6877ad9f17..a4ac27f0796d0c483ad86f2dab3212b95e42ed04 100644 (file)
@@ -582,8 +582,6 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
        /*printf("dir is : %i\n", dir);*/
        
        if (dir == -1) {
-               if (sa1) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
-               if (sa2) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                return 0;
        }
        
@@ -614,8 +612,7 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
        
        screen_delarea(C, scr, sa2);
        removedouble_scrverts(scr);
-       sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
-       
+
        return 1;
 }
 
@@ -1105,16 +1102,15 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
        }
 }
 
-/* only for edge lines between areas, and the blended join arrows */
-void ED_screen_draw(wmWindow *win)
+/**
+ * Only for edge lines between areas, and the blended join arrows.
+ */
+void ED_screen_draw_edges(wmWindow *win)
 {
        const int winsize_x = WM_window_pixels_x(win);
        const int winsize_y = WM_window_pixels_y(win);
 
        ScrArea *sa;
-       ScrArea *sa1 = NULL;
-       ScrArea *sa2 = NULL;
-       ScrArea *sa3 = NULL;
 
        wmSubWindowSet(win, win->screen->mainwin);
        
@@ -1134,69 +1130,70 @@ void ED_screen_draw(wmWindow *win)
        glBegin(GL_LINES);
        for (sa = win->screen->areabase.first; sa; sa = sa->next) {
                drawscredge_area(sa, winsize_x, winsize_y);
-
-               /* gather area split/join info */
-               if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
-               if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
-               if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
        }
        glEnd();
 
-       /* blended join arrow */
-       if (sa1 && sa2) {
-               int dir = area_getorientation(sa1, sa2);
-               int dira = -1;
-               if (dir != -1) {
-                       switch (dir) {
-                               case 0: /* W */
-                                       dir = 'r';
-                                       dira = 'l';
-                                       break;
-                               case 1: /* N */
-                                       dir = 'd';
-                                       dira = 'u';
-                                       break;
-                               case 2: /* E */
-                                       dir = 'l';
-                                       dira = 'r';
-                                       break;
-                               case 3: /* S */
-                                       dir = 'u';
-                                       dira = 'd';
-                                       break;
-                       }
+       win->screen->do_draw = false;
+}
+
+void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2)
+{
+       glLineWidth(1);
+
+    /* blended join arrow */
+       int dir = area_getorientation(sa1, sa2);
+       int dira = -1;
+       if (dir != -1) {
+               switch (dir) {
+                       case 0: /* W */
+                               dir = 'r';
+                               dira = 'l';
+                               break;
+                       case 1: /* N */
+                               dir = 'd';
+                               dira = 'u';
+                               break;
+                       case 2: /* E */
+                               dir = 'l';
+                               dira = 'r';
+                               break;
+                       case 3: /* S */
+                               dir = 'u';
+                               dira = 'd';
+                               break;
                }
                glEnable(GL_BLEND);
                scrarea_draw_shape_dark(sa2, dir);
                scrarea_draw_shape_light(sa1, dira);
                glDisable(GL_BLEND);
        }
-       
+}
+
+void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac)
+{
        /* splitpoint */
-       if (sa3) {
-               glEnable(GL_BLEND);
-               glBegin(GL_LINES);
-               glColor4ub(255, 255, 255, 100);
-               
-               if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
-                       glVertex2s(sa3->totrct.xmin, win->eventstate->y);
-                       glVertex2s(sa3->totrct.xmax, win->eventstate->y);
-                       glColor4ub(0, 0, 0, 100);
-                       glVertex2s(sa3->totrct.xmin, win->eventstate->y + 1);
-                       glVertex2s(sa3->totrct.xmax, win->eventstate->y + 1);
-               }
-               else {
-                       glVertex2s(win->eventstate->x, sa3->totrct.ymin);
-                       glVertex2s(win->eventstate->x, sa3->totrct.ymax);
-                       glColor4ub(0, 0, 0, 100);
-                       glVertex2s(win->eventstate->x + 1, sa3->totrct.ymin);
-                       glVertex2s(win->eventstate->x + 1, sa3->totrct.ymax);
-               }
-               glEnd();
-               glDisable(GL_BLEND);
-       }
+       glEnable(GL_BLEND);
+       glBegin(GL_LINES);
+       glColor4ub(255, 255, 255, 100);
        
-       win->screen->do_draw = false;
+       if (dir == 'h') {
+               const float y = (1 - fac) * sa->totrct.ymin + fac * sa->totrct.ymax;
+               glVertex2s(sa->totrct.xmin, y);
+               glVertex2s(sa->totrct.xmax, y);
+               glColor4ub(0, 0, 0, 100);
+               glVertex2s(sa->totrct.xmin, y + 1);
+               glVertex2s(sa->totrct.xmax, y + 1);
+       }
+       else {
+               const float x = (1 - fac) * sa->totrct.xmin + fac * sa->totrct.xmax;
+               glVertex2s(x, sa->totrct.ymin);
+               glVertex2s(x, sa->totrct.ymax);
+               glColor4ub(0, 0, 0, 100);
+               glVertex2s(x + 1, sa->totrct.ymin);
+               glVertex2s(x + 1, sa->totrct.ymax);
+       }
+       glEnd();
+       glDisable(GL_BLEND);
 }
 
 /* helper call for below, dpi changes headers */
index 176bdc764a2ada0decb8fbbfd1423ceab47a3321..c4be0a2259f468a1d6fbb8f40e932327c7e2a318 100644 (file)
@@ -1180,18 +1180,15 @@ static int area_snap_calc_location(
 
        const int m_loc = origval + delta;
        const int axis = (dir == 'v') ? 0 : 1;
-       int snap_dist = INT_MAX;
+       int snap_dist;
        int dist;
        {
                /* Test the snap to middle. */
                int middle = origval + (bigger - smaller) / 2;
                middle -= (middle % AREAGRID);
 
-               dist = abs(m_loc - middle);
-               if (dist <= snap_dist) {
-                       snap_dist = dist;
-                       final_loc = middle;
-               }
+               snap_dist = abs(m_loc - middle);
+               final_loc = middle;
        }
 
        for (const ScrVert *v1 = sc->vertbase.first; v1; v1 = v1->next) {
@@ -1433,6 +1430,7 @@ typedef struct sAreaSplitData {
        int delta;              /* delta move edge */
        int origmin, origsize;  /* to calculate fac, for property storage */
        int previewmode;        /* draw previewline, then split */
+       void *draw_callback;    /* call `ED_screen_draw_split_preview` */
        bool do_snap;
 
        ScrEdge *nedge;         /* new edge */
@@ -1441,6 +1439,19 @@ typedef struct sAreaSplitData {
        
 } sAreaSplitData;
 
+static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
+{
+       const wmOperator *op = userdata;
+
+       sAreaSplitData *sd = op->customdata;
+       if (sd->sarea) {
+               int dir = RNA_enum_get(op->ptr, "direction");
+               float fac = RNA_float_get(op->ptr, "factor");
+
+               ED_screen_draw_split_preview(sd->sarea, dir, fac);
+       }
+}
+
 /* generic init, menu case, doesn't need active area */
 static int area_split_menu_init(bContext *C, wmOperator *op)
 {
@@ -1451,15 +1462,7 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
        op->customdata = sd;
        
        sd->sarea = CTX_wm_area(C);
-       
-       if (sd->sarea) {
-               int dir = RNA_enum_get(op->ptr, "direction");
 
-               if (dir == 'h')
-                       sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
-               else
-                       sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
-       }
        return 1;
 }
 
@@ -1568,9 +1571,9 @@ static void area_split_exit(bContext *C, wmOperator *op)
                if (sd->sarea) ED_area_tag_redraw(sd->sarea);
                if (sd->narea) ED_area_tag_redraw(sd->narea);
 
-               if (sd->sarea)
-                       sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
-               
+               if (sd->draw_callback)
+                       WM_draw_cb_exit(CTX_wm_window(C), sd->draw_callback);
+
                MEM_freeN(op->customdata);
                op->customdata = NULL;
        }
@@ -1677,6 +1680,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
        }
        else {
                sd->previewmode = 1;
+               sd->draw_callback = WM_draw_cb_activate(win, area_split_draw_cb, op);
                /* add temp handler for edge move or cancel */
                WM_event_add_modal_handler(C, op);
                
@@ -1734,9 +1738,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
                        if (sd->previewmode == 0)
                                area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, sd->do_snap);
                        else {
-                               /* TODO: Snap in preview mode too. */
                                if (sd->sarea) {
-                                       sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
                                        ED_area_tag_redraw(sd->sarea);
                                }
                                /* area context not set */
@@ -1747,22 +1749,31 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                        if (dir == 'v') {
                                                sd->origsize = sd->sarea->winx;
                                                sd->origmin = sd->sarea->totrct.xmin;
-                                               sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
                                        }
                                        else {
                                                sd->origsize = sd->sarea->winy;
                                                sd->origmin = sd->sarea->totrct.ymin;
-                                               sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
                                        }
+
+                                       if (sd->do_snap) {
+                                               ScrArea *sa = sd->sarea;
+                                               sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
+
+                                               int snap_loc = area_snap_calc_location(
+                                                       CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
+
+                                               sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
+                                               fac = snap_loc - sd->origmin;
+                                       }
+                                       else {
+                                               fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin;
+                                       }
+                                       RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
                                }
                                
                                CTX_wm_window(C)->screen->do_draw = true;
 
                        }
-                       
-                       fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin;
-                       RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
-                       
                        break;
                        
                case LEFTMOUSE:
@@ -1788,19 +1799,14 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                
                                if (event->val == KM_PRESS) {
                                        if (sd->sarea) {
-                                               sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
                                                ED_area_tag_redraw(sd->sarea);
                                                
                                                if (dir == 'v') {
                                                        RNA_enum_set(op->ptr, "direction", 'h');
-                                                       sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
-                                                       
                                                        WM_cursor_set(CTX_wm_window(C), CURSOR_X_MOVE);
                                                }
                                                else {
                                                        RNA_enum_set(op->ptr, "direction", 'v');
-                                                       sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
-                                                       
                                                        WM_cursor_set(CTX_wm_window(C), CURSOR_Y_MOVE);
                                                }
                                        }
@@ -2590,13 +2596,23 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
  */
 
 typedef struct sAreaJoinData {
-       ScrArea *sa1;   /* first area to be considered */
-       ScrArea *sa2;   /* second area to be considered */
-       ScrArea *scr;   /* designed for removal */
+       ScrArea *sa1;        /* first area to be considered */
+       ScrArea *sa2;        /* second area to be considered */
+       void *draw_callback; /* call `ED_screen_draw_join_shape` */
 
 } sAreaJoinData;
 
 
+static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
+{
+       const wmOperator *op = userdata;
+
+       sAreaJoinData *sd = op->customdata;
+       if (sd->sa1 && sd->sa2) {
+               ED_screen_draw_join_shape(sd->sa1, sd->sa2);
+       }
+}
+
 /* validate selection inside screen, set variables OK */
 /* return 0: init failed */
 /* XXX todo: find edge based on (x,y) and set other area? */
@@ -2630,14 +2646,14 @@ static int area_join_init(bContext *C, wmOperator *op)
        }
        
        jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
-       
+
        jd->sa1 = sa1;
-       jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
        jd->sa2 = sa2;
-       jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
-       
+
        op->customdata = jd;
-       
+
+       jd->draw_callback = WM_draw_cb_activate(CTX_wm_window(C), area_join_draw_cb, op);
+
        return 1;
 }
 
@@ -2661,8 +2677,13 @@ static int area_join_apply(bContext *C, wmOperator *op)
 /* finish operation */
 static void area_join_exit(bContext *C, wmOperator *op)
 {
-       if (op->customdata) {
-               MEM_freeN(op->customdata);
+       sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
+
+       if (jd) {
+               if (jd->draw_callback)
+                       WM_draw_cb_exit(CTX_wm_window(C), jd->draw_callback);
+
+               MEM_freeN(jd);
                op->customdata = NULL;
        }
        
@@ -2721,17 +2742,6 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
 static void area_join_cancel(bContext *C, wmOperator *op)
 {
-       sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
-       
-       if (jd->sa1) {
-               jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
-               jd->sa1->flag &= ~AREA_FLAG_DRAWJOINTO;
-       }
-       if (jd->sa2) {
-               jd->sa2->flag &= ~AREA_FLAG_DRAWJOINFROM;
-               jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
-       }
-       
        WM_event_add_notifier(C, NC_WINDOW, NULL);
        
        area_join_exit(C, op);
@@ -2755,9 +2765,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                if (jd->sa1 != sa) {
                                        dir = area_getorientation(jd->sa1, sa);
                                        if (dir != -1) {
-                                               if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                                                jd->sa2 = sa;
-                                               jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
                                        }
                                        else {
                                                /* we are not bordering on the previously selected area 
@@ -2766,15 +2774,10 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                                 */
                                                dir = area_getorientation(sa, jd->sa2);
                                                if (dir != -1) {
-                                                       if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
-                                                       if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                                                        jd->sa1 = jd->sa2;
                                                        jd->sa2 = sa;
-                                                       if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
-                                                       if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
                                                }
                                                else {
-                                                       if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                                                        jd->sa2 = NULL;
                                                }
                                        }
@@ -2784,12 +2787,8 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                        /* we are back in the area previously selected for keeping 
                                         * we swap the areas if possible to allow user to choose */
                                        if (jd->sa2 != NULL) {
-                                               if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
-                                               if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                                                jd->sa1 = jd->sa2;
                                                jd->sa2 = sa;
-                                               if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
-                                               if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
                                                dir = area_getorientation(jd->sa1, jd->sa2);
                                                if (dir == -1) {
                                                        printf("oops, didn't expect that!\n");
@@ -2798,9 +2797,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                        else {
                                                dir = area_getorientation(jd->sa1, sa);
                                                if (dir != -1) {
-                                                       if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
                                                        jd->sa2 = sa;
-                                                       jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
                                                }
                                        }
                                        WM_event_add_notifier(C, NC_WINDOW, NULL);
index fd63d7c471c16a77e09081d89a32c7c513e2915e..a33aad4f343376c27a44d0ccaba6fd8866220f15 100644 (file)
@@ -280,11 +280,11 @@ typedef struct ARegion {
 /* area->flag */
 enum {
        HEADER_NO_PULLDOWN           = (1 << 0),
-       AREA_FLAG_DRAWJOINTO         = (1 << 1),
-       AREA_FLAG_DRAWJOINFROM       = (1 << 2),
+//     AREA_FLAG_DEPRECATED_1       = (1 << 1),
+//     AREA_FLAG_DEPRECATED_2       = (1 << 2),
        AREA_TEMP_INFO               = (1 << 3),
-       AREA_FLAG_DRAWSPLIT_H        = (1 << 4),
-       AREA_FLAG_DRAWSPLIT_V        = (1 << 5),
+//     AREA_FLAG_DEPRECATED_4       = (1 << 4),
+//     AREA_FLAG_DEPRECATED_5       = (1 << 5),
        /* used to check if we should switch back to prevspace (of a different type) */
        AREA_FLAG_TEMP_TYPE          = (1 << 6),
        /* for temporary fullscreens (file browser, image editor render) that are opened above user set fullscreens */
index 16116036e868dc7c377a127cff8d9d37dab03618..06185a583bb7749a9a4a2e5bb2e4dc330ccd1453 100644 (file)
@@ -220,6 +220,9 @@ typedef struct wmWindow {
        ListBase gesture;             /* gesture stuff */
 
        struct Stereo3dFormat *stereo3d_format; /* properties for stereoscopic displays */
+
+       /* custom drawing callbacks */
+       ListBase drawcalls;
 } wmWindow;
 
 #ifdef ime_data
index 9dc4b35abb4fa39de88ac095fdc8d0574bdbc1c8..e84239f1c67a3214413238018422f6ef004a60cd 100644 (file)
@@ -506,6 +506,11 @@ void               WM_progress_set(struct wmWindow *win, float progress);
 void           WM_progress_clear(struct wmWindow *win);
 
                        /* Draw (for screenshot) */
+void        *WM_draw_cb_activate(
+                    struct wmWindow *win,
+                    void(*draw)(const struct wmWindow *, void *),
+                    void *customdata);
+void        WM_draw_cb_exit(struct wmWindow *win, void *handle);
 void           WM_redraw_windows(struct bContext *C);
 
 void        WM_main_playanim(int argc, const char **argv);
index f802e8735556d3eb9778cc4a493e47a21913a98a..fdbe1345accdf75a655134206bc12afc0b306eb7 100644 (file)
@@ -157,6 +157,46 @@ static void wm_region_test_render_do_draw(bScreen *screen, ScrArea *sa, ARegion
 /********************** draw all **************************/
 /* - reference method, draw all each time                 */
 
+typedef struct WindowDrawCB {
+       struct WindowDrawCB *next, *prev;
+
+       void(*draw)(const struct wmWindow *, void *);
+       void *customdata;
+
+} WindowDrawCB;
+
+void *WM_draw_cb_activate(
+        wmWindow *win,
+        void(*draw)(const struct wmWindow *, void *),
+        void *customdata)
+{
+       WindowDrawCB *wdc = MEM_callocN(sizeof(*wdc), "WindowDrawCB");
+
+       BLI_addtail(&win->drawcalls, wdc);
+       wdc->draw = draw;
+       wdc->customdata = customdata;
+
+       return wdc;
+}
+
+void WM_draw_cb_exit(wmWindow *win, void *handle)
+{
+       for (WindowDrawCB *wdc = win->drawcalls.first; wdc; wdc = wdc->next) {
+               if (wdc == (WindowDrawCB *)handle) {
+                       BLI_remlink(&win->drawcalls, wdc);
+                       MEM_freeN(wdc);
+                       return;
+               }
+       }
+}
+
+static void wm_draw_callbacks(wmWindow *win)
+{
+       for (WindowDrawCB *wdc = win->drawcalls.first; wdc; wdc = wdc->next) {
+               wdc->draw(win, wdc->customdata);
+       }
+}
+
 static void wm_method_draw_full(bContext *C, wmWindow *win)
 {
        bScreen *screen = win->screen;
@@ -181,8 +221,9 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
                CTX_wm_area_set(C, NULL);
        }
 
-       ED_screen_draw(win);
-       win->screen->do_draw = false;
+       ED_screen_draw_edges(win);
+       screen->do_draw = false;
+       wm_draw_callbacks(win);
 
        /* draw overlapping regions */
        for (ar = screen->regionbase.first; ar; ar = ar->next) {
@@ -318,17 +359,19 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
 
        /* after area regions so we can do area 'overlay' drawing */
        if (screen->do_draw) {
-               ED_screen_draw(win);
-               win->screen->do_draw = false;
+               ED_screen_draw_edges(win);
+               screen->do_draw = false;
+               wm_draw_callbacks(win);
 
                if (exchange)
                        screen->swap = WIN_FRONT_OK;
        }
        else if (exchange) {
                if (screen->swap == WIN_FRONT_OK) {
-                       ED_screen_draw(win);
-                       win->screen->do_draw = false;
+                       ED_screen_draw_edges(win);
+                       screen->do_draw = false;
                        screen->swap = WIN_BOTH_OK;
+                       wm_draw_callbacks(win);
                }
                else if (screen->swap == WIN_BACK_OK)
                        screen->swap = WIN_FRONT_OK;
@@ -622,8 +665,9 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
        }
 
        /* after area regions so we can do area 'overlay' drawing */
-       ED_screen_draw(win);
+       ED_screen_draw_edges(win);
        win->screen->do_draw = false;
+       wm_draw_callbacks(win);
 
        /* draw floating regions (menus) */
        for (ar = screen->regionbase.first; ar; ar = ar->next) {
@@ -792,9 +836,10 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
        }
 
        /* after area regions so we can do area 'overlay' drawing */
-       ED_screen_draw(win);
+       ED_screen_draw_edges(win);
        if (sview == STEREO_RIGHT_ID)
                win->screen->do_draw = false;
+       wm_draw_callbacks(win);
 
        /* draw floating regions (menus) */
        for (ar = screen->regionbase.first; ar; ar = ar->next) {