[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54220] trunk/blender/source/blender/ windowmanager/intern/wm_window.c: fix/workaround [#34026] Blender starts with too large window

Campbell Barton ideasman42 at gmail.com
Thu Jan 31 06:37:59 CET 2013


Revision: 54220
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54220
Author:   campbellbarton
Date:     2013-01-31 05:37:52 +0000 (Thu, 31 Jan 2013)
Log Message:
-----------
fix/workaround [#34026] Blender starts with too large window

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.

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	2013-01-30 23:54:49 UTC (rev 54219)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c	2013-01-31 05:37:52 UTC (rev 54220)
@@ -425,6 +425,15 @@
 			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 @@
 				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;
 			}




More information about the Bf-blender-cvs mailing list