From d6a6f285d6b1983d2cf823e81570ad03dbc5bf06 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 10 Mar 2012 17:49:26 +0000 Subject: patch [#30511] Save/load window state (allows Blender to start maximised) from Tom Edwards (artfunkel) This patch fixes bug [#20791] --- source/blender/windowmanager/intern/wm.c | 2 +- source/blender/windowmanager/intern/wm_window.c | 18 ++++++------------ source/blender/windowmanager/wm_window.h | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index bed49941efd..ea0a7388059 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -255,7 +255,7 @@ void WM_check(bContext *C) } /* case: no open windows at all, for old file reads */ - wm_window_add_ghostwindows(C, wm); + wm_window_add_ghostwindows(wm); } /* case: fileread */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 2e3e56f7c23..ed1a5f9d577 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -304,17 +304,10 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } /* belongs to below */ -static void wm_window_add_ghostwindow(bContext *C, const char *title, wmWindow *win) +static void wm_window_add_ghostwindow(const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; 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); @@ -329,7 +322,7 @@ static void wm_window_add_ghostwindow(bContext *C, const 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, - initial_state, + (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, 0 /* no AA */); @@ -339,7 +332,7 @@ static void wm_window_add_ghostwindow(bContext *C, const char *title, wmWindow * GPU_extensions_init(); /* set the state*/ - GHOST_SetWindowState(ghostwin, initial_state); + GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); win->ghostwin= ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ @@ -368,7 +361,7 @@ static void wm_window_add_ghostwindow(bContext *C, const 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(bContext* C, wmWindowManager *wm) +void wm_window_add_ghostwindows(wmWindowManager *wm) { wmKeyMap *keymap; wmWindow *win; @@ -404,7 +397,7 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) win->windowstate= initialstate; useprefsize= 0; } - wm_window_add_ghostwindow(C, "Blender", win); + wm_window_add_ghostwindow("Blender", win); } /* happens after fileread */ if(win->eventstate==NULL) @@ -698,6 +691,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) case GHOST_kEventWindowMove: { GHOST_TWindowState state; state = GHOST_GetWindowState(win->ghostwin); + win->windowstate = state; /* win32: gives undefined window size when minimized */ if(state!=GHOST_kWindowStateMinimized) { diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 27eb4542877..6fd4ced9c23 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -46,7 +46,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 (bContext *C, wmWindowManager *wm); +void wm_window_add_ghostwindows (wmWindowManager *wm); void wm_window_process_events (const bContext *C); void wm_window_process_events_nosleep(void); -- cgit v1.2.3