[Bf-taskforce25] Blender 2.5 on windows - maximised on startup

Matt Ebb matt at mke3.net
Wed May 6 08:29:21 CEST 2009


Hi,

Blender 2.5 on Windows doesn't start maximised. Unlike Blender 2.4*,
it just starts up as a bordered window, that's the same dimension as
the screen. For non-windows users who don't understand the difference,
it causes some undesirable behaviour:
* currently it starts with window borders, which are easy to grab by accident
* the bottom part of blender can get hidden by the windows task bar,
which overlaps it, and
* even though Blender's window size is the same as the screen, because
the window borders usually take up a few pixels on either size, the
rightmost edge of Blender gets pushed off screen.

I did a bit of digging around in the windowmanager, and found the
problem. In order to support restoring multi-window blend files,
Blender remembers the dimensions of each window, and on opening a
file, goes through all the windows and restores them to the previous
sizes. The problem is it only remembers the sizes, not whether the
window was maximised or not.

I've made a patch that stores the window state (maximised vs normal)
in the already available wmWindow->windowstate . This means that if a
window is saved in a maximized state, it will open up again in a
maximized state too. Then the only change that needs to be made is
saving the built-in .b.blend (startup.blend? ;) maximised, and
everything should be fine.

I don't know how this will affect other OSes though, or multiple
screen setups. I don't think it would be disruptive, but some testing
would be good. I'll test it myself on a dual screen Mac OS X setup,
but if people could patch, and try opening the following .blend file
(which was saved maximised), and see if it does anything crazy, that
would be really great.

http://mke3.net/blender/devel/2.5/maximized_window_b25.blend

thanks!

Matt


Patch follows:



Index: source/blender/windowmanager/intern/wm_files.c
===================================================================
--- source/blender/windowmanager/intern/wm_files.c      (revision 20077)
+++ source/blender/windowmanager/intern/wm_files.c      (working copy)
@@ -211,6 +211,8 @@
                                               win->sizey= oldwin->sizey;
                                               win->posx= oldwin->posx;
                                               win->posy= oldwin->posy;
+                                               win->windowstate =
oldwin->windowstate;
+
GHOST_SetWindowState(win->ghostwin, win->windowstate);
                                       }
                               }
                       }
Index: source/blender/windowmanager/intern/wm_window.c
===================================================================
--- source/blender/windowmanager/intern/wm_window.c     (revision 20077)
+++ source/blender/windowmanager/intern/wm_window.c     (working copy)
@@ -220,7 +220,8 @@

       //              inital_state = GHOST_kWindowStateFullScreen;
       //              inital_state = GHOST_kWindowStateMaximized;
-       inital_state = GHOST_kWindowStateNormal;
+       //              inital_state = GHOST_kWindowStateNormal;
+       inital_state = win->windowstate;

 #ifdef __APPLE__
       {
@@ -289,7 +290,7 @@
                               win->posy= prefstay;
                               win->sizex= prefsizx;
                               win->sizey= prefsizy;
-                               win->windowstate= 0;
+                               win->windowstate= GHOST_kWindowStateNormal;
                       }
                       wm_window_add_ghostwindow(wm, "Blender", win);
               }
@@ -498,7 +499,12 @@
                                       win->sizey= b-t;
                                       win->posx= l;
                                       win->posy= scr_h - t - win->sizey;
-
+                                       if(state==GHOST_kWindowStateMaximized)
+                                               win->windowstate =
GHOST_kWindowStateMaximized;
+                                       else if(state==GHOST_kWindowStateNormal)
+                                               win->windowstate =
GHOST_kWindowStateNormal;
+
+
                                       /* debug prints */
                                       if(0) {
                                               state =
GHOST_GetWindowState(win->ghostwin);


More information about the Bf-taskforce25 mailing list