Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm.c
| Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* on startup, it adds all data, for matching */ | /* on startup, it adds all data, for matching */ | ||||
| void wm_add_default(bContext *C) | void wm_add_default(bContext *C) | ||||
| { | { | ||||
| wmWindowManager *wm = BKE_libblock_alloc(CTX_data_main(C), ID_WM, "WinMan"); | wmWindowManager *wm = BKE_libblock_alloc(CTX_data_main(C), ID_WM, "WinMan"); | ||||
| wmWindow *win; | wmWindow *win; | ||||
| bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */ | bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */ | ||||
| struct WorkSpace *workspace = G.main->workspaces.last; | |||||
| CTX_wm_manager_set(C, wm); | CTX_wm_manager_set(C, wm); | ||||
| win = wm_window_new(C); | win = wm_window_new(C); | ||||
| win->screen = screen; | WM_window_set_active_workspace(win, workspace); | ||||
| WM_window_set_active_screen(win, workspace, screen); | |||||
| screen->winid = win->winid; | screen->winid = win->winid; | ||||
| BLI_strncpy(win->screenname, screen->id.name + 2, sizeof(win->screenname)); | BLI_strncpy(win->screenname, screen->id.name + 2, sizeof(win->screenname)); | ||||
| wm->winactive = win; | wm->winactive = win; | ||||
| wm->file_saved = 1; | wm->file_saved = 1; | ||||
| wm_window_make_drawable(wm, win); | wm_window_make_drawable(wm, win); | ||||
| } | } | ||||
| /* context is allowed to be NULL, do not free wm itself (library.c) */ | /* context is allowed to be NULL, do not free wm itself (library.c) */ | ||||
| void wm_close_and_free(bContext *C, wmWindowManager *wm) | void wm_close_and_free(bContext *C, wmWindowManager *wm) | ||||
| { | { | ||||
| wmWindow *win; | wmWindow *win; | ||||
| wmOperator *op; | wmOperator *op; | ||||
| wmKeyConfig *keyconf; | wmKeyConfig *keyconf; | ||||
| if (wm->autosavetimer) | if (wm->autosavetimer) | ||||
| wm_autosave_timer_ended(wm); | wm_autosave_timer_ended(wm); | ||||
| while ((win = BLI_pophead(&wm->windows))) { | while ((win = BLI_pophead(&wm->windows))) { | ||||
| win->screen = NULL; /* prevent draw clear to use screen */ | WM_window_set_active_workspace(win, NULL); /* prevent draw clear to use screen */ | ||||
| wm_draw_window_clear(win); | wm_draw_window_clear(win); | ||||
| wm_window_free(C, wm, win); | wm_window_free(C, wm, win); | ||||
| } | } | ||||
| while ((op = BLI_pophead(&wm->operators))) { | while ((op = BLI_pophead(&wm->operators))) { | ||||
| WM_operator_free(op); | WM_operator_free(op); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||