diff options
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 38 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_window.h | 2 | ||||
-rw-r--r-- | source/creator/creator.c | 7 |
5 files changed, 33 insertions, 18 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9668b2e17c9..d04e08eda14 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -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); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index cce1c140787..148932fa941 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.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) { diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 45234464ef0..4baad110232 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -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) { diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index d57fd0e75d8..5a425df01e1 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -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); diff --git a/source/creator/creator.c b/source/creator/creator.c index aa970f8f48b..4066d16186b 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.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; } |