[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44851] trunk/blender/source/blender/ windowmanager/intern/wm_window.c: patch [#30511] from r44792, broke setting the window state from the command line (-W / -w).
Campbell Barton
ideasman42 at gmail.com
Tue Mar 13 16:44:52 CET 2012
Revision: 44851
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44851
Author: campbellbarton
Date: 2012-03-13 15:44:48 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
patch [#30511] from r44792, broke setting the window state from the command line (-W / -w).
Fix this by storing if the border is set - before this was only done for the window dimensions.
also move these variables into a static struct so this logic is easier to follow.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44792
Modified Paths:
--------------
trunk/blender/source/blender/windowmanager/intern/wm_window.c
Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c 2012-03-13 14:28:58 UTC (rev 44850)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c 2012-03-13 15:44:48 UTC (rev 44851)
@@ -78,10 +78,21 @@
/* the global to talk to ghost */
static GHOST_SystemHandle g_system= NULL;
+typedef enum WinOverrideFlag {
+ WIN_OVERRIDE_GEOM = (1 << 0),
+ WIN_OVERRIDE_WINSTATE = (1 << 1)
+} WinOverrideFlag;
+
/* set by commandline */
-static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal;
-static unsigned short useprefsize= 0;
+static struct WMInitStruct {
+ /* window geometry */
+ int size_x, size_y;
+ int start_x, start_y;
+ int windowstate;
+ WinOverrideFlag override_flag;
+} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0};
+
/* ******** win open & close ************ */
/* XXX this one should correctly check for apple top header...
@@ -370,33 +381,37 @@
* Note that these values will be used only
* when there is no startup.blend yet.
*/
- if (!prefsizx) {
- wm_get_screensize(&prefsizx, &prefsizy);
+ 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(prefsizx, prefsizy);
+ wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
}
#else
- prefstax= 0;
- prefstay= 0;
+ 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 || useprefsize) {
- win->posx= prefstax;
- win->posy= prefstay;
- win->sizex= prefsizx;
- win->sizey= prefsizy;
- win->windowstate= initialstate;
- useprefsize= 0;
+ 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_window_add_ghostwindow("Blender", win);
}
/* happens after fileread */
@@ -1144,22 +1159,24 @@
/* called whem no ghost system was initialized */
void WM_setprefsize(int stax, int stay, int sizx, int sizy)
{
- prefstax= stax;
- prefstay= stay;
- prefsizx= sizx;
- prefsizy= sizy;
- useprefsize= 1;
+ wm_init_state.start_x = stax; /* left hand pos */
+ wm_init_state.start_y = stay; /* bottom pos */
+ wm_init_state.size_x = sizx;
+ wm_init_state.size_y = sizy;
+ wm_init_state.override_flag |= WIN_OVERRIDE_GEOM;
}
/* for borderless and border windows set from command-line */
void WM_setinitialstate_fullscreen(void)
{
- initialstate= GHOST_kWindowStateFullScreen;
+ wm_init_state.windowstate = GHOST_kWindowStateFullScreen;
+ wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
void WM_setinitialstate_normal(void)
{
- initialstate= GHOST_kWindowStateNormal;
+ wm_init_state.windowstate = GHOST_kWindowStateNormal;
+ wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
/* This function requires access to the GHOST_SystemHandle (g_system) */
More information about the Bf-blender-cvs
mailing list