/* called in WM_check, also inits stuff after file read */ void wm_window_add_ghostwindows(wmWindowManager *wm) { wmKeyMap *keymap; wmWindow *win; /* no commandline prefsize? then we set this. * Note that these values will be used only * when there is no startup.blend yet. */ if (wm_init_state.size_x == 0) { wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y); #if defined(__APPLE__) && !defined(GHOST_COCOA) /* Cocoa provides functions to get correct max window size */ { extern void wm_set_apple_prefsize(int, int); /* wm_apple.c */ wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y); } #else wm_init_state.start_x = 0; wm_init_state.start_y = 0; #endif } for (win = wm->windows.first; win; win = win->next) { if (win->ghostwin == NULL) { if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) { win->posx = wm_init_state.start_x; win->posy = wm_init_state.start_y; win->sizex = wm_init_state.size_x; win->sizey = wm_init_state.size_y; wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM; } if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) { win->windowstate = wm_init_state.windowstate; wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE; } wm_window_add_ghostwindow("Blender", win); } /* happens after fileread */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); /* add keymap handlers (1 handler for all keys in map!) */ keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0); WM_event_add_keymap_handler(&win->modalhandlers, keymap); /* add drop boxes */ { ListBase *lb = WM_dropboxmap_find("Window", 0, 0); WM_event_add_dropbox_handler(&win->handlers, lb); } wm_window_title(wm, win); } }
/* called in WM_check, also inits stuff after file read */ void wm_window_add_ghostwindows(wmWindowManager *wm) { wmKeyMap *keymap; wmWindow *win; /* no commandline prefsize? then we set this. * Note that these values will be used only * when there is no startup.blend yet. */ if (wm_init_state.size_x == 0) { wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y); /* note!, this isnt quite correct, active screen maybe offset 1000s if PX, * we'd need a wm_get_screensize like function that gives offset, * in practice the window manager will likely move to the correct monitor */ wm_init_state.start_x = 0; wm_init_state.start_y = 0; #ifdef WITH_X11 /* X11 */ /* X11, start maximized but use default sane size */ wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X); wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y); /* pad */ wm_init_state.start_x = WM_WIN_INIT_PAD; wm_init_state.start_y = WM_WIN_INIT_PAD; wm_init_state.size_x -= WM_WIN_INIT_PAD * 2; wm_init_state.size_y -= WM_WIN_INIT_PAD * 2; #endif } for (win = wm->windows.first; win; win = win->next) { if (win->ghostwin == NULL) { if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) { win->posx = wm_init_state.start_x; win->posy = wm_init_state.start_y; win->sizex = wm_init_state.size_x; win->sizey = wm_init_state.size_y; win->windowstate = GHOST_kWindowStateNormal; wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM; } if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) { win->windowstate = wm_init_state.windowstate; wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE; } /* without this, cursor restore may fail, T45456 */ if (win->cursor == 0) { win->cursor = CURSOR_STD; } wm_window_add_ghostwindow(wm, "Blender", win); } /* happens after fileread */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); /* add keymap handlers (1 handler for all keys in map!) */ keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0); WM_event_add_keymap_handler(&win->modalhandlers, keymap); /* add drop boxes */ { ListBase *lb = WM_dropboxmap_find("Window", 0, 0); WM_event_add_dropbox_handler(&win->handlers, lb); } wm_window_title(wm, win); } }