fix/workaround [#34026] Blender starts with too large window
authorCampbell Barton <ideasman42@gmail.com>
Thu, 31 Jan 2013 05:37:52 +0000 (05:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 31 Jan 2013 05:37:52 +0000 (05:37 +0000)
Minimal change to stop blender window opening across all monitors.

Workaround the problem by starting maximized, and using sane defaults for non maximized window.

I checked on a few different solutions to this, Using Xinerama works OK, but with different size monitors
and not knowing which one the window-manager will pick in advance - this can be wrong too.

Now instead of opening with the screen size, just start maximized and use a default size for the non-maximized window (clamped by the screen size).

This isn't perfect since you could have 2x monitors at 1024x768, open blender, un-maximize - and blender window would cross over into the second monitor.

source/blender/windowmanager/intern/wm_window.c

index 44c5693c3e32b5b37bb6a7dffd340acbcdc684c2..bd6342ebc25d593e5ec34c7cdfddb783538d808d 100644 (file)
@@ -425,6 +425,15 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
                        wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
                }
 #else
+               /* default size when un-maximized, unless the screen(s) are smaller */
+
+               /* clamp by these arbitrary values because currently wm_get_screensize()
+                * will span multiple monitors and using xinerama isnt totally reliable
+                * since we don't which monitor the window manager will put the blender
+                * window in. */
+               wm_init_state.size_x = MIN2(1800, wm_init_state.size_x - 100);
+               wm_init_state.size_y = MIN2(980,  wm_init_state.size_y - 100);
+
                wm_init_state.start_x = 0;
                wm_init_state.start_y = 0;
                
@@ -439,8 +448,14 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
                                win->sizex = wm_init_state.size_x;
                                win->sizey = wm_init_state.size_y;
 
-                               /* we can't properly resize a maximized window */
-                               win->windowstate = GHOST_kWindowStateNormal;
+                               if (wm_init_state.override_flag & WIN_OVERRIDE_GEOM) {
+                                       /* we can't properly resize a maximized window */
+                                       win->windowstate = GHOST_kWindowStateNormal;
+                               }
+                               else {
+                                       /* otherwise default factory settings start maximized */
+                                       win->windowstate = GHOST_kWindowStateMaximized;
+                               }
 
                                wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
                        }