Docs: add docstring for wmWindowManger.winactive

Also justify rounding up font width.
This commit is contained in:
Campbell Barton 2021-10-27 13:59:43 +11:00
parent a3b785bc08
commit 0d155f274f
2 changed files with 10 additions and 1 deletions

View File

@ -400,6 +400,8 @@ int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs,
int width = UI_fontstyle_string_width(fs, str);
if (aspect != 1.0f) {
/* While in most cases rounding up isn't important, it can make a difference
* with small fonts (3px or less), zooming out in the node-editor for e.g. */
width = (int)ceilf(width * aspect);
}
return width;

View File

@ -138,7 +138,14 @@ typedef struct wmWindowManager {
ID id;
/** Separate active from drawable. */
struct wmWindow *windrawable, *winactive;
struct wmWindow *windrawable;
/**
* \note `CTX_wm_window(C)` is usually preferred.
* Avoid relying on this where possible as this may become NULL during when handling
* events that close or replace windows (opening a file for e.g.).
* While this happens rarely in practice, it can cause difficult to reproduce bugs.
*/
struct wmWindow *winactive;
ListBase windows;
/** Set on file read. */