Docs: improve doc-strings for window size & startup file

Document the purpose of zero sized window & when wm_init_state is used.
Noticed when looking into #108643.
This commit is contained in:
Campbell Barton
2023-06-08 10:10:18 +10:00
parent 989b5de8e9
commit 47189c5253
2 changed files with 23 additions and 3 deletions

View File

@@ -267,8 +267,19 @@ typedef struct wmWindow {
/** Window-ID also in screens, is for retrieving this window after read. */
int winid;
/** Window coords. */
short posx, posy, sizex, sizey;
/** Window coords (in pixels). */
short posx, posy;
/**
* Window size (in pixels).
*
* \note Loading a window typically uses the size & position saved in the blend-file,
* there is an exception for startup files which works as follows:
* Setting the window size to zero before `ghostwin` has been set has a special meaning,
* it causes the window size to be initialized to `wm_init_state.size_x` (& `size_y`).
* These default to the main screen size but can be overridden by the `--window-geometry`
* command line argument.
*/
short sizex, sizey;
/** Normal, maximized, full-screen, #GHOST_TWindowState. */
char windowstate;
/** Set to 1 if an active window, for quick rejects. */

View File

@@ -105,7 +105,16 @@ typedef enum eWinOverrideFlag {
* These values are typically set by command line arguments.
*/
static struct WMInitStruct {
/* window geometry */
/**
* Window geometry:
* - Defaults to the main screen-size.
* - May be set by the `--window-geometry` argument,
* which also forces these values to be used by setting #WIN_OVERRIDE_GEOM.
* - When #wmWindow::size_x is zero, these values are used as a fallback,
* needed so the #BLENDER_STARTUP_FILE loads at the size of the users main-screen
* instead of the size stored in the factory startup.
* Otherwise the window geometry saved in the blend-file is used and these values are ignored.
*/
int size_x, size_y;
int start_x, start_y;