diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-07 18:41:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-07 18:41:08 +0400 |
commit | 3a31e1ef27d48ed2841ae863754bf17d954ece35 (patch) | |
tree | cbacc0541249233334d140faf6a3d24ff4414044 | |
parent | 95bca1c6bc379c073c0d933d72aeff7bcfdd2563 (diff) |
start blender maximized on X11 - finding screen limits taking window borders, title bar, panels & multi-monitor is quite involved - without this size if often wrong.
For sizes outside the screen bounds many window managers will ignore the requested size.
Also opening maximized was default with 2.49.
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 20 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_window.h | 6 |
2 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index caf4e2bd1ac..d8b987a196c 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -43,6 +43,7 @@ #include "GHOST_C-api.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -442,6 +443,13 @@ void wm_window_add_ghostwindows(wmWindowManager *wm) wm_init_state.start_x = 0; wm_init_state.start_y = 0; #endif + +#if !defined(__APPLE__) && !defined(WIN32) /* X11 */ + /* X11, start maximized but use default same size */ + wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X); + wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y); +#endif + } for (win = wm->windows.first; win; win = win->next) { @@ -452,8 +460,18 @@ 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 */ +#if !defined(__APPLE__) && !defined(WIN32) /* X11 */ + if (wm_init_state.override_flag & WIN_OVERRIDE_GEOM) { + /* we can't properly resize a maximized window */ + win->windowstate = GHOST_kWindowStateNormal; + } + else { + /* loading without userpref, default to maximized */ + win->windowstate = GHOST_kWindowStateMaximized; + } +#else win->windowstate = GHOST_kWindowStateNormal; +#endif wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM; } diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 739ead27bdb..c4c64ed429f 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -69,5 +69,11 @@ void wm_window_testbreak (void); int wm_window_duplicate_exec(bContext *C, struct wmOperator *op); int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op); +/* Initial (unmaximized) size to start with for + * systems that can't find it for themselves (X11). + * Clamped by real desktop limits */ +#define WM_WIN_INIT_SIZE_X 1800 +#define WM_WIN_INIT_SIZE_Y 1000 + #endif /* __WM_WINDOW_H__ */ |