diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-19 09:31:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-19 09:37:01 +0300 |
commit | 4444ea42f29c9b006fd20c9fb6de5787ad98f30f (patch) | |
tree | eae8908bfeae8ef77ef8a4cedef020adbf44b06d /source/blender/windowmanager/intern | |
parent | c850320b35863edc35f0b0acd1c75ed48bb71542 (diff) | |
parent | ebf01d44ee0e034da169efc0aca81f99966ebde6 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index c6b25ff8079..92bb81d2221 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -162,6 +162,46 @@ static void wm_region_test_render_do_draw(const Scene *scene, ScrArea *sa, ARegi /********************** 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 = WM_window_get_active_screen(win); @@ -186,8 +226,9 @@ static void wm_method_draw_full(bContext *C, wmWindow *win) CTX_wm_area_set(C, NULL); } - ED_screen_draw(win); + 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) { @@ -323,17 +364,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); + 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); + 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; @@ -627,8 +670,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); WM_window_get_active_screen(win)->do_draw = false; + wm_draw_callbacks(win); /* draw floating regions (menus) */ for (ar = screen->regionbase.first; ar; ar = ar->next) { @@ -802,10 +846,12 @@ 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) screen->do_draw = false; + wm_draw_callbacks(win); + /* draw floating regions (menus) */ for (ar = screen->regionbase.first; ar; ar = ar->next) { if (ar->swinid) { |