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.
This commit is contained in:
Campbell Barton
2013-01-31 05:37:52 +00:00
parent d7623c0e16
commit 29456505f3

View 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;
}