Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_window.c
| Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | for (wt = wm->timers.first; wt; wt = wtnext) { | ||||
| if (wt->win == win) | if (wt->win == win) | ||||
| WM_event_remove_timer(wm, win, wt); | WM_event_remove_timer(wm, win, wt); | ||||
| } | } | ||||
| if (win->eventstate) MEM_freeN(win->eventstate); | if (win->eventstate) MEM_freeN(win->eventstate); | ||||
| wm_event_free_all(win); | wm_event_free_all(win); | ||||
| wm_draw_data_free(win); | |||||
| wm_ghostwindow_destroy(wm, win); | wm_ghostwindow_destroy(wm, win); | ||||
| BKE_workspace_instance_hook_free(G.main, win->workspace_hook); | BKE_workspace_instance_hook_free(G.main, win->workspace_hook); | ||||
| MEM_freeN(win->stereo3d_format); | MEM_freeN(win->stereo3d_format); | ||||
| MEM_freeN(win); | MEM_freeN(win); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | wmWindow *wm_window_copy(bContext *C, wmWindow *win_src, const bool duplicate_layout) | ||||
| win_dst->sizex = win_src->sizex; | win_dst->sizex = win_src->sizex; | ||||
| win_dst->sizey = win_src->sizey; | win_dst->sizey = win_src->sizey; | ||||
| win_dst->scene = scene; | win_dst->scene = scene; | ||||
| WM_window_set_active_workspace(win_dst, workspace); | WM_window_set_active_workspace(win_dst, workspace); | ||||
| layout_new = duplicate_layout ? ED_workspace_layout_duplicate(workspace, layout_old, win_dst) : layout_old; | layout_new = duplicate_layout ? ED_workspace_layout_duplicate(workspace, layout_old, win_dst) : layout_old; | ||||
| WM_window_set_active_layout(win_dst, workspace, layout_new); | WM_window_set_active_layout(win_dst, workspace, layout_new); | ||||
| win_dst->drawmethod = U.wmdrawmethod; | |||||
| BLI_listbase_clear(&win_dst->drawdata); | |||||
| *win_dst->stereo3d_format = *win_src->stereo3d_format; | *win_dst->stereo3d_format = *win_src->stereo3d_format; | ||||
| return win_dst; | return win_dst; | ||||
| } | } | ||||
| /** | /** | ||||
| * A higher level version of copy that tests the new window can be added. | * A higher level version of copy that tests the new window can be added. | ||||
| * (called from the operator directly) | * (called from the operator directly) | ||||
| ▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) | ||||
| } | } | ||||
| else { | else { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| WorkSpace *workspace = WM_window_get_active_workspace(win); | WorkSpace *workspace = WM_window_get_active_workspace(win); | ||||
| WorkSpaceLayout *layout = BKE_workspace_active_layout_get(win->workspace_hook); | WorkSpaceLayout *layout = BKE_workspace_active_layout_get(win->workspace_hook); | ||||
| BLI_remlink(&wm->windows, win); | BLI_remlink(&wm->windows, win); | ||||
| wm_draw_window_clear(win); | |||||
| CTX_wm_window_set(C, win); /* needed by handlers */ | CTX_wm_window_set(C, win); /* needed by handlers */ | ||||
| WM_event_remove_handlers(C, &win->handlers); | WM_event_remove_handlers(C, &win->handlers); | ||||
| WM_event_remove_handlers(C, &win->modalhandlers); | WM_event_remove_handlers(C, &win->modalhandlers); | ||||
| /* for regular use this will _never_ be NULL, | /* for regular use this will _never_ be NULL, | ||||
| * however we may be freeing an improperly initialized window. */ | * however we may be freeing an improperly initialized window. */ | ||||
| if (screen) { | if (screen) { | ||||
| ED_screen_exit(C, win, screen); | ED_screen_exit(C, win, screen); | ||||
| ▲ Show 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | wmWindow *WM_window_open(bContext *C, const rcti *rect) | ||||
| wmWindow *win_prev = CTX_wm_window(C); | wmWindow *win_prev = CTX_wm_window(C); | ||||
| wmWindow *win = wm_window_new(C); | wmWindow *win = wm_window_new(C); | ||||
| win->posx = rect->xmin; | win->posx = rect->xmin; | ||||
| win->posy = rect->ymin; | win->posy = rect->ymin; | ||||
| win->sizex = BLI_rcti_size_x(rect); | win->sizex = BLI_rcti_size_x(rect); | ||||
| win->sizey = BLI_rcti_size_y(rect); | win->sizey = BLI_rcti_size_y(rect); | ||||
| win->drawmethod = U.wmdrawmethod; | |||||
| WM_check(C); | WM_check(C); | ||||
| if (win->ghostwin) { | if (win->ghostwin) { | ||||
| return win; | return win; | ||||
| } | } | ||||
| else { | else { | ||||
| wm_window_close(C, CTX_wm_manager(C), win); | wm_window_close(C, CTX_wm_manager(C), win); | ||||
| CTX_wm_window_set(C, win_prev); | CTX_wm_window_set(C, win_prev); | ||||
| ▲ Show 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | #undef USE_WIN_ACTIVATE | ||||
| if (type != GHOST_kEventWindowSize) { | if (type != GHOST_kEventWindowSize) { | ||||
| printf("win move event pos %d %d size %d %d\n", | printf("win move event pos %d %d size %d %d\n", | ||||
| win->posx, win->posy, win->sizex, win->sizey); | win->posx, win->posy, win->sizex, win->sizey); | ||||
| } | } | ||||
| } | } | ||||
| wm_window_make_drawable(wm, win); | wm_window_make_drawable(wm, win); | ||||
| wm_draw_window_clear(win); | |||||
| BKE_icon_changed(screen->id.icon_id); | BKE_icon_changed(screen->id.icon_id); | ||||
| WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); | ||||
| WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL); | ||||
| #if defined(__APPLE__) || defined(WIN32) | #if defined(__APPLE__) || defined(WIN32) | ||||
| /* OSX and Win32 don't return to the mainloop while resize */ | /* OSX and Win32 don't return to the mainloop while resize */ | ||||
| wm_event_do_notifiers(C); | wm_event_do_notifiers(C); | ||||
| wm_draw_update(C); | wm_draw_update(C); | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | #endif | ||||
| // close all popups since they are positioned with the pixel | // close all popups since they are positioned with the pixel | ||||
| // size baked in and it's difficult to correct them | // size baked in and it's difficult to correct them | ||||
| wmWindow *oldWindow = CTX_wm_window(C); | wmWindow *oldWindow = CTX_wm_window(C); | ||||
| CTX_wm_window_set(C, win); | CTX_wm_window_set(C, win); | ||||
| UI_popup_handlers_remove_all(C, &win->modalhandlers); | UI_popup_handlers_remove_all(C, &win->modalhandlers); | ||||
| CTX_wm_window_set(C, oldWindow); | CTX_wm_window_set(C, oldWindow); | ||||
| wm_window_make_drawable(wm, win); | wm_window_make_drawable(wm, win); | ||||
| wm_draw_window_clear(win); | |||||
| WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); | ||||
| WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case GHOST_kEventTrackpad: | case GHOST_kEventTrackpad: | ||||
| ▲ Show 20 Lines • Show All 674 Lines • Show Last 20 Lines | |||||