Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2010-09-15 15:48:59 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-09-15 15:48:59 +0400
commit8a25c33fca7f63ccaaaaddfdfcc9537ef0e3222d (patch)
tree9dcaa0a71c9463db5044be28abead2fde85733ee /source/blender/windowmanager
parent90bd472ef2b9438a71a84980c1311b40a12b81ec (diff)
Apply patch [#23809] Blender.exe -W support
by Dalai Felinto/Nathan Letwory This basically implements -W support for Blender.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_window.c38
-rw-r--r--source/blender/windowmanager/wm_window.h2
4 files changed, 31 insertions, 13 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);