Apply patch [#23809] Blender.exe -W support

by Dalai Felinto/Nathan Letwory

This basically implements -W support for Blender.
This commit is contained in:
Nathan Letwory 2010-09-15 11:48:59 +00:00
parent 90bd472ef2
commit 8a25c33fca
5 changed files with 33 additions and 18 deletions

@ -52,6 +52,8 @@ typedef struct wmJob wmJob;
/* general API */
void WM_setprefsize (int stax, int stay, int sizx, int sizy);
void WM_setinitialstate_fullscreen();
void WM_setinitialstate_normal();
void WM_init (struct bContext *C, int argc, char **argv);
void WM_exit (struct bContext *C);

@ -231,7 +231,7 @@ void WM_check(bContext *C)
}
/* case: no open windows at all, for old file reads */
wm_window_add_ghostwindows(wm);
wm_window_add_ghostwindows(C, wm);
/* case: fileread */
if((wm->initialized & WM_INIT_WINDOW) == 0) {

@ -67,7 +67,7 @@
GHOST_SystemHandle g_system= NULL;
/* set by commandline */
static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0;
static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal;
/* ******** win open & close ************ */
@ -289,19 +289,21 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
}
/* belongs to below */
static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow *win)
static void wm_window_add_ghostwindow(bContext *C, wmWindowManager *wm, char *title, wmWindow *win)
{
GHOST_WindowHandle ghostwin;
GHOST_TWindowState inital_state;
int scr_w, scr_h, posy;
GHOST_TWindowState initial_state;
/* when there is no window open uses the initial state */
if(!CTX_wm_window(C))
initial_state= initialstate;
else
initial_state= GHOST_kWindowStateNormal;
wm_get_screensize(&scr_w, &scr_h);
posy= (scr_h - win->posy - win->sizey);
// inital_state = GHOST_kWindowStateFullScreen;
// inital_state = GHOST_kWindowStateMaximized;
inital_state = GHOST_kWindowStateNormal;
#if defined(__APPLE__) && !defined(GHOST_COCOA)
{
extern int macPrefState; /* creator.c */
@ -312,13 +314,16 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow
doesn't work well when AA is initialized, even if not used. */
ghostwin= GHOST_CreateWindow(g_system, title,
win->posx, posy, win->sizex, win->sizey,
inital_state,
initial_state,
GHOST_kDrawingContextTypeOpenGL,
0 /* no stereo */,
0 /* no AA */);
if (ghostwin) {
/* set the state*/
GHOST_SetWindowState(ghostwin, initial_state);
win->ghostwin= ghostwin;
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
@ -342,7 +347,7 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow
/* for wmWindows without ghostwin, open these and clear */
/* window size is read from window, if 0 it uses prefsize */
/* called in WM_check, also inits stuff after file read */
void wm_window_add_ghostwindows(wmWindowManager *wm)
void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
{
wmKeyMap *keymap;
wmWindow *win;
@ -372,9 +377,9 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
win->posy= prefstay;
win->sizex= prefsizx;
win->sizey= prefsizy;
win->windowstate= 0;
win->windowstate= initialstate;
}
wm_window_add_ghostwindow(wm, "Blender", win);
wm_window_add_ghostwindow(C, wm, "Blender", win);
}
/* happens after fileread */
if(win->eventstate==NULL)
@ -1106,6 +1111,17 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy)
prefsizy= sizy;
}
/* for borderless and border windows set from command-line */
void WM_setinitialstate_fullscreen()
{
initialstate= GHOST_kWindowStateFullScreen;
}
void WM_setinitialstate_normal()
{
initialstate= GHOST_kWindowStateNormal;
}
/* This function requires access to the GHOST_SystemHandle (g_system) */
void WM_cursor_warp(wmWindow *win, int x, int y)
{

@ -43,7 +43,7 @@ void wm_window_free (bContext *C, wmWindowManager *wm, wmWindow *win);
void wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win);
void wm_window_title (wmWindowManager *wm, wmWindow *win);
void wm_window_add_ghostwindows (wmWindowManager *wm);
void wm_window_add_ghostwindows (bContext *C, wmWindowManager *wm);
void wm_window_process_events (const bContext *C);
void wm_window_process_events_nosleep(const bContext *C);

@ -412,16 +412,13 @@ static int prefsize(int argc, char **argv, void *data)
static int with_borders(int argc, char **argv, void *data)
{
/* with borders XXX OLD CRUFT!*/
WM_setinitialstate_normal();
return 0;
}
static int without_borders(int argc, char **argv, void *data)
{
/* borderless, win + linux XXX OLD CRUFT */
/* XXX, fixme mein, borderless on OSX */
WM_setinitialstate_fullscreen();
return 0;
}