Screen: add exit callback for area and region types, this gets called when

hiding or removing an area or region.
This commit is contained in:
Brecht Van Lommel
2013-03-15 19:56:29 +00:00
parent 433c82649e
commit 88cf1a2bc7
12 changed files with 85 additions and 51 deletions

View File

@@ -75,6 +75,8 @@ typedef struct SpaceType {
/* init is to cope with file load, screen (size) changes, check handlers */ /* init is to cope with file load, screen (size) changes, check handlers */
void (*init)(struct wmWindowManager *, struct ScrArea *); void (*init)(struct wmWindowManager *, struct ScrArea *);
/* exit is called when the area is hidden or removed */
void (*exit)(struct wmWindowManager *, struct ScrArea *);
/* Listeners can react to bContext changes */ /* Listeners can react to bContext changes */
void (*listener)(struct ScrArea *, struct wmNotifier *); void (*listener)(struct ScrArea *, struct wmNotifier *);
@@ -116,6 +118,8 @@ typedef struct ARegionType {
/* add handlers, stuff you only do once or on area/region type/size changes */ /* add handlers, stuff you only do once or on area/region type/size changes */
void (*init)(struct wmWindowManager *, struct ARegion *); void (*init)(struct wmWindowManager *, struct ARegion *);
/* exit is called when the region is hidden or removed */
void (*exit)(struct wmWindowManager *, struct ARegion *);
/* draw entirely, view changes should be handled here */ /* draw entirely, view changes should be handled here */
void (*draw)(const struct bContext *, struct ARegion *); void (*draw)(const struct bContext *, struct ARegion *);
/* contextual changes should be handled here */ /* contextual changes should be handled here */

View File

@@ -31,10 +31,11 @@
#ifndef __ED_FILESELECT_H__ #ifndef __ED_FILESELECT_H__
#define __ED_FILESELECT_H__ #define __ED_FILESELECT_H__
struct SpaceFile;
struct ARegion; struct ARegion;
struct FileSelectParams; struct FileSelectParams;
struct SpaceFile;
struct bContext; struct bContext;
struct wmWindowManager;
#define FILE_LAYOUT_HOR 1 #define FILE_LAYOUT_HOR 1
#define FILE_LAYOUT_VER 2 #define FILE_LAYOUT_VER 2
@@ -99,9 +100,9 @@ void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y);
void ED_operatormacros_file(void); void ED_operatormacros_file(void);
void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile); void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile);
void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile); void ED_fileselect_exit(struct wmWindowManager *wm, struct SpaceFile *sfile);
int ED_file_extension_icon(const char *relname); int ED_file_extension_icon(const char *relname);

View File

@@ -1137,8 +1137,12 @@ void ED_screens_initialize(wmWindowManager *wm)
void ED_region_exit(bContext *C, ARegion *ar) void ED_region_exit(bContext *C, ARegion *ar)
{ {
wmWindowManager *wm = CTX_wm_manager(C);
ARegion *prevar = CTX_wm_region(C); ARegion *prevar = CTX_wm_region(C);
if (ar->type && ar->type->exit)
ar->type->exit(wm, ar);
CTX_wm_region_set(C, ar); CTX_wm_region_set(C, ar);
WM_event_remove_handlers(C, &ar->handlers); WM_event_remove_handlers(C, &ar->handlers);
if (ar->swinid) if (ar->swinid)
@@ -1157,18 +1161,12 @@ void ED_region_exit(bContext *C, ARegion *ar)
void ED_area_exit(bContext *C, ScrArea *sa) void ED_area_exit(bContext *C, ScrArea *sa)
{ {
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *prevsa = CTX_wm_area(C); ScrArea *prevsa = CTX_wm_area(C);
ARegion *ar; ARegion *ar;
if (sa->spacetype == SPACE_FILE) { if (sa->type && sa->type->exit)
SpaceLink *sl = sa->spacedata.first; sa->type->exit(wm, sa);
if (sl && sl->spacetype == SPACE_FILE) {
ED_fileselect_exit(C, (SpaceFile *)sl);
}
}
else if (sa->spacetype == SPACE_VIEW3D) {
ED_render_engine_area_exit(sa);
}
CTX_wm_area_set(C, sa); CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) for (ar = sa->regionbase.first; ar; ar = ar->next)

View File

@@ -56,6 +56,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h" #include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "RNA_access.h" #include "RNA_access.h"
@@ -397,6 +398,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
char newname[FILE_MAX + 12]; char newname[FILE_MAX + 12];
char orgname[FILE_MAX + 12]; char orgname[FILE_MAX + 12];
char filename[FILE_MAX + 12]; char filename[FILE_MAX + 12];
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C); SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
@@ -408,7 +410,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
if (!BLI_exists(newname)) { if (!BLI_exists(newname)) {
BLI_rename(orgname, newname); BLI_rename(orgname, newname);
/* to make sure we show what is on disk */ /* to make sure we show what is on disk */
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
} }
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);

View File

@@ -612,12 +612,13 @@ void FILE_OT_highlight(struct wmOperatorType *ot)
int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
wmOperator *op = sfile->op; wmOperator *op = sfile->op;
sfile->op = NULL; sfile->op = NULL;
WM_event_fileselect_event(C, op, EVT_FILESELECT_CANCEL); WM_event_fileselect_event(wm, op, EVT_FILESELECT_CANCEL);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
@@ -780,6 +781,7 @@ int file_draw_check_exists(SpaceFile *sfile)
/* sends events now, so things get handled on windowqueue level */ /* sends events now, so things get handled on windowqueue level */
int file_exec(bContext *C, wmOperator *exec_op) int file_exec(bContext *C, wmOperator *exec_op)
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
char filepath[FILE_MAX]; char filepath[FILE_MAX];
@@ -811,7 +813,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu_get(), filepath); fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); WM_event_fileselect_event(wm, op, EVT_FILESELECT_EXEC);
} }
@@ -871,10 +873,11 @@ void FILE_OT_parent(struct wmOperatorType *ot)
static int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) static int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused))
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
struct FSMenu *fsmenu = fsmenu_get(); struct FSMenu *fsmenu = fsmenu_get();
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
/* refresh system directory menu */ /* refresh system directory menu */
fsmenu_refresh_system_category(fsmenu); fsmenu_refresh_system_category(fsmenu);
@@ -1088,6 +1091,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
char path[FILE_MAX]; char path[FILE_MAX];
int generate_name = 1; int generate_name = 1;
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
if (!sfile->params) { if (!sfile->params) {
@@ -1126,7 +1130,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
sfile->scroll_offset = 0; sfile->scroll_offset = 0;
/* reload dir to make sure we're seeing what's in the directory */ /* reload dir to make sure we're seeing what's in the directory */
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
@@ -1291,11 +1295,12 @@ void FILE_OT_refresh(struct wmOperatorType *ot)
static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused)) static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) { if (sfile->params) {
sfile->params->flag ^= FILE_HIDE_DOT; sfile->params->flag ^= FILE_HIDE_DOT;
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
} }
@@ -1477,6 +1482,7 @@ static int file_delete_poll(bContext *C)
int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
{ {
char str[FILE_MAX]; char str[FILE_MAX];
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
struct direntry *file; struct direntry *file;
@@ -1484,7 +1490,7 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
file = filelist_file(sfile->files, sfile->params->active_file); file = filelist_file(sfile->files, sfile->params->active_file);
BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
BLI_delete(str, false, false); BLI_delete(str, false, false);
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;

View File

@@ -1337,7 +1337,7 @@ static void thumbnails_free(void *tjv)
} }
void thumbnails_start(struct FileList *filelist, const struct bContext *C) void thumbnails_start(FileList *filelist, const bContext *C)
{ {
wmJob *wm_job; wmJob *wm_job;
ThumbnailJob *tj; ThumbnailJob *tj;
@@ -1349,7 +1349,7 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
for (idx = 0; idx < filelist->numfiles; idx++) { for (idx = 0; idx < filelist->numfiles; idx++) {
if (!filelist->filelist[idx].image) { if (!filelist->filelist[idx].image) {
if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) { if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) {
FileImage *limg = MEM_callocN(sizeof(struct FileImage), "loadimage"); FileImage *limg = MEM_callocN(sizeof(FileImage), "loadimage");
BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX); BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX);
limg->index = idx; limg->index = idx;
limg->flags = filelist->filelist[idx].flags; limg->flags = filelist->filelist[idx].flags;
@@ -1371,12 +1371,12 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
WM_jobs_start(CTX_wm_manager(C), wm_job); WM_jobs_start(CTX_wm_manager(C), wm_job);
} }
void thumbnails_stop(struct FileList *filelist, const struct bContext *C) void thumbnails_stop(wmWindowManager *wm, FileList *filelist)
{ {
WM_jobs_kill(CTX_wm_manager(C), filelist, NULL); WM_jobs_kill(wm, filelist, NULL);
} }
int thumbnails_running(struct FileList *filelist, const struct bContext *C) int thumbnails_running(wmWindowManager *wm, FileList *filelist)
{ {
return WM_jobs_test(CTX_wm_manager(C), filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL); return WM_jobs_test(wm, filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL);
} }

View File

@@ -37,15 +37,16 @@
extern "C" { extern "C" {
#endif #endif
struct FileList;
struct FolderList;
struct direntry;
struct BlendHandle; struct BlendHandle;
struct Scene; struct FileList;
struct Main;
struct rcti;
struct ReportList;
struct FileSelection; struct FileSelection;
struct FolderList;
struct Main;
struct ReportList;
struct Scene;
struct direntry;
struct rcti;
struct wmWindowManager;
typedef enum FileSelType { typedef enum FileSelType {
FILE_SEL_REMOVE = 0, FILE_SEL_REMOVE = 0,
@@ -99,9 +100,9 @@ void folderlist_popdir(struct ListBase *folderlist, char *dir);
void folderlist_pushdir(struct ListBase *folderlist, const char *dir); void folderlist_pushdir(struct ListBase *folderlist, const char *dir);
int folderlist_clear_next(struct SpaceFile *sfile); int folderlist_clear_next(struct SpaceFile *sfile);
void thumbnails_stop(struct FileList *filelist, const struct bContext *C);
void thumbnails_start(struct FileList *filelist, const struct bContext *C); void thumbnails_start(struct FileList *filelist, const struct bContext *C);
int thumbnails_running(struct FileList *filelist, const struct bContext *C); void thumbnails_stop(struct wmWindowManager *wm, struct FileList *filelist);
int thumbnails_running(struct wmWindowManager *wm, struct FileList *filelist);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -578,11 +578,12 @@ FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *ar)
void file_change_dir(bContext *C, int checkdir) void file_change_dir(bContext *C, int checkdir)
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) { if (sfile->params) {
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
if (checkdir && !BLI_is_dir(sfile->params->dir)) { if (checkdir && !BLI_is_dir(sfile->params->dir)) {
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir)); BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
@@ -691,24 +692,24 @@ void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
} }
} }
void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile) void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile)
{ {
/* only NULL in rare cases - [#29734] */ /* only NULL in rare cases - [#29734] */
if (sfile->files) { if (sfile->files) {
thumbnails_stop(sfile->files, C); thumbnails_stop(wm, sfile->files);
filelist_freelib(sfile->files); filelist_freelib(sfile->files);
filelist_free(sfile->files); filelist_free(sfile->files);
} }
sfile->params->active_file = -1; sfile->params->active_file = -1;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); WM_main_add_notifier(NC_SPACE | ND_SPACE_FILE_LIST, NULL);
} }
void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile) void ED_fileselect_exit(struct wmWindowManager *wm, struct SpaceFile *sfile)
{ {
if (!sfile) return; if (!sfile) return;
if (sfile->op) { if (sfile->op) {
WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL); WM_event_fileselect_event(wm, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
sfile->op = NULL; sfile->op = NULL;
} }
@@ -716,7 +717,7 @@ void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
folderlist_free(sfile->folders_next); folderlist_free(sfile->folders_next);
if (sfile->files) { if (sfile->files) {
ED_fileselect_clear(C, sfile); ED_fileselect_clear(wm, sfile);
MEM_freeN(sfile->files); MEM_freeN(sfile->files);
sfile->files = NULL; sfile->files = NULL;
} }

View File

@@ -146,7 +146,7 @@ static void file_free(SpaceLink *sl)
/* spacetype; init callback, area size changes, screen set, etc */ /* spacetype; init callback, area size changes, screen set, etc */
static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) static void file_init(wmWindowManager *UNUSED(wm), ScrArea *sa)
{ {
SpaceFile *sfile = (SpaceFile *)sa->spacedata.first; SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
//printf("file_init\n"); //printf("file_init\n");
@@ -157,6 +157,12 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
if (sfile->layout) sfile->layout->dirty = TRUE; if (sfile->layout) sfile->layout->dirty = TRUE;
} }
static void file_exit(wmWindowManager *wm, ScrArea *sa)
{
SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
ED_fileselect_exit(wm, sfile);
}
static SpaceLink *file_duplicate(SpaceLink *sl) static SpaceLink *file_duplicate(SpaceLink *sl)
{ {
@@ -186,6 +192,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
{ {
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile); FileSelectParams *params = ED_fileselect_get_params(sfile);
@@ -201,7 +208,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
filelist_setfilter_types(sfile->files, params->filter_glob); filelist_setfilter_types(sfile->files, params->filter_glob);
if (filelist_empty(sfile->files)) { if (filelist_empty(sfile->files)) {
thumbnails_stop(sfile->files, C); thumbnails_stop(wm, sfile->files);
filelist_readdir(sfile->files); filelist_readdir(sfile->files);
if (params->sort != FILE_SORT_NONE) { if (params->sort != FILE_SORT_NONE) {
filelist_sort(sfile->files, params->sort); filelist_sort(sfile->files, params->sort);
@@ -213,7 +220,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
} }
else { else {
if (params->sort != FILE_SORT_NONE) { if (params->sort != FILE_SORT_NONE) {
thumbnails_stop(sfile->files, C); thumbnails_stop(wm, sfile->files);
filelist_sort(sfile->files, params->sort); filelist_sort(sfile->files, params->sort);
if (params->display == FILE_IMGDISPLAY) { if (params->display == FILE_IMGDISPLAY) {
thumbnails_start(sfile->files, C); thumbnails_start(sfile->files, C);
@@ -221,14 +228,14 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
} }
else { else {
if (params->display == FILE_IMGDISPLAY) { if (params->display == FILE_IMGDISPLAY) {
if (!thumbnails_running(sfile->files, C)) { if (!thumbnails_running(wm, sfile->files)) {
thumbnails_start(sfile->files, C); thumbnails_start(sfile->files, C);
} }
} }
else { else {
/* stop any running thumbnail jobs if we're not /* stop any running thumbnail jobs if we're not
* displaying them - speedup for NFS */ * displaying them - speedup for NFS */
thumbnails_stop(sfile->files, C); thumbnails_stop(wm, sfile->files);
} }
filelist_filter(sfile->files); filelist_filter(sfile->files);
} }
@@ -576,6 +583,7 @@ void ED_spacetype_file(void)
st->new = file_new; st->new = file_new;
st->free = file_free; st->free = file_free;
st->init = file_init; st->init = file_init;
st->exit = file_exit;
st->duplicate = file_duplicate; st->duplicate = file_duplicate;
st->refresh = file_refresh; st->refresh = file_refresh;
st->listener = file_listener; st->listener = file_listener;

View File

@@ -48,6 +48,7 @@
#include "BKE_object.h" #include "BKE_object.h"
#include "BKE_screen.h" #include "BKE_screen.h"
#include "ED_render.h"
#include "ED_space_api.h" #include "ED_space_api.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_object.h" #include "ED_object.h"
@@ -350,7 +351,7 @@ static void view3d_free(SpaceLink *sl)
/* spacetype; init callback */ /* spacetype; init callback */
static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{ {
} }
@@ -469,6 +470,16 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
} }
static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar)
{
RegionView3D *rv3d = ar->regiondata;
if (rv3d->render_engine) {
RE_engine_free(rv3d->render_engine);
rv3d->render_engine = NULL;
}
}
static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{ {
if (drag->type == WM_DRAG_ID) { if (drag->type == WM_DRAG_ID) {
@@ -1216,6 +1227,7 @@ void ED_spacetype_view3d(void)
art->keymapflag = ED_KEYMAP_GPENCIL; art->keymapflag = ED_KEYMAP_GPENCIL;
art->draw = view3d_main_area_draw; art->draw = view3d_main_area_draw;
art->init = view3d_main_area_init; art->init = view3d_main_area_init;
art->exit = view3d_main_area_exit;
art->free = view3d_main_area_free; art->free = view3d_main_area_free;
art->duplicate = view3d_main_area_duplicate; art->duplicate = view3d_main_area_duplicate;
art->listener = view3d_main_area_listener; art->listener = view3d_main_area_listener;

View File

@@ -306,7 +306,7 @@ void WM_gestures_remove(struct bContext *C);
/* fileselecting support */ /* fileselecting support */
void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op); void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op);
void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval); void WM_event_fileselect_event(struct wmWindowManager *wm, void *ophandle, int eventval);
#ifndef NDEBUG #ifndef NDEBUG
void WM_event_print(const struct wmEvent *event); void WM_event_print(const struct wmEvent *event);
#endif #endif

View File

@@ -2244,12 +2244,12 @@ void wm_event_do_handlers(bContext *C)
/* ********** filesector handling ************ */ /* ********** filesector handling ************ */
void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval) void WM_event_fileselect_event(wmWindowManager *wm, void *ophandle, int eventval)
{ {
/* add to all windows! */ /* add to all windows! */
wmWindow *win; wmWindow *win;
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) { for (win = wm->windows.first; win; win = win->next) {
wmEvent event = *win->eventstate; wmEvent event = *win->eventstate;
event.type = EVT_FILESELECT; event.type = EVT_FILESELECT;
@@ -2271,6 +2271,7 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
void WM_event_add_fileselect(bContext *C, wmOperator *op) void WM_event_add_fileselect(bContext *C, wmOperator *op)
{ {
wmEventHandler *handler, *handlernext; wmEventHandler *handler, *handlernext;
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C); wmWindow *win = CTX_wm_window(C);
int full = 1; // XXX preset? int full = 1; // XXX preset?
@@ -2302,7 +2303,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
op->type->check(C, op); /* ignore return value */ op->type->check(C, op); /* ignore return value */
} }
WM_event_fileselect_event(C, op, full ? EVT_FILESELECT_FULL_OPEN : EVT_FILESELECT_OPEN); WM_event_fileselect_event(wm, op, full ? EVT_FILESELECT_FULL_OPEN : EVT_FILESELECT_OPEN);
} }
#if 0 #if 0