diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_undo.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender_undo.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 7 |
6 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index cd18bd8db40..9547eeb9838 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -45,6 +45,8 @@ extern const char *BKE_undo_get_name(int nr, bool *r_active); extern bool BKE_undo_save_file(const char *filename); extern struct Main *BKE_undo_get_main(struct Scene **r_scene); +extern void BKE_undo_callback_wm_kill_jobs_set(void (*callback)(struct bContext *C)); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 6af9f8a71ee..b7ff81d603b 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -49,9 +49,6 @@ set(INC ../../../intern/smoke/extern ../../../intern/atomic ../../../intern/libmv - - # XXX - BAD LEVEL CALL WM_api.h - ../windowmanager ) set(INC_SYS diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index ca0a1b91cea..d64bf7ecf43 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -66,9 +66,6 @@ #include "BLO_readfile.h" #include "BLO_writefile.h" -#include "WM_api.h" // XXXXX BAD, very BAD dependency (bad level call) - remove asap, elubie - - /* -------------------------------------------------------------------- */ /** \name Global Undo @@ -87,6 +84,15 @@ typedef struct UndoElem { static ListBase undobase = {NULL, NULL}; static UndoElem *curundo = NULL; +/** + * Avoid bad-level call to #WM_jobs_kill_all_except() + */ +static void (*undo_wm_job_kill_callback)(struct bContext *C) = NULL; + +void BKE_undo_callback_wm_kill_jobs_set(void (*callback)(struct bContext *C)) +{ + undo_wm_job_kill_callback = callback; +} static int read_undosave(bContext *C, UndoElem *uel) { @@ -94,7 +100,7 @@ static int read_undosave(bContext *C, UndoElem *uel) int success = 0, fileflags; /* This is needed so undoing/redoing doesn't crash with threaded previews going */ - WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); + undo_wm_job_kill_callback(C); BLI_strncpy(mainstr, G.main->name, sizeof(mainstr)); /* temporal store */ diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 14a445649ad..69384a70969 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -95,8 +95,6 @@ #include "DNA_screen_types.h" #include "DNA_view3d_types.h" -#include "WM_api.h" - static SpinLock image_spin; /* prototypes */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 7b8f4986325..e0a3e9743db 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -55,8 +55,6 @@ #include "PIL_time.h" -#include "WM_api.h" - #include "BKE_appdir.h" #include "BKE_anim.h" #include "BKE_cloth.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 2c9deb05328..9d1083bbf63 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -141,6 +141,11 @@ static void wm_free_reports(bContext *C) BKE_reports_clear(reports); } +static void wm_undo_kill_callback(bContext *C) +{ + WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); +} + bool wm_start_with_console = false; /* used in creator.c */ /* only called once, for startup */ @@ -159,6 +164,8 @@ void WM_init(bContext *C, int argc, const char **argv) WM_menutype_init(); WM_uilisttype_init(); + BKE_undo_callback_wm_kill_jobs_set(wm_undo_kill_callback); + BKE_library_callback_free_window_manager_set(wm_close_and_free); /* library.c */ BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference); /* library.c */ BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference); /* library.c */ |