[Bf-blender-cvs] [0d155f274ff] master: Docs: add docstring for wmWindowManger.winactive
Campbell Barton
noreply at git.blender.org
Wed Oct 27 06:58:33 CEST 2021
Commit: 0d155f274ff2ca2dcf52745e32f17c05a9d1c890
Author: Campbell Barton
Date: Wed Oct 27 13:59:43 2021 +1100
Branches: master
https://developer.blender.org/rB0d155f274ff2ca2dcf52745e32f17c05a9d1c890
Docs: add docstring for wmWindowManger.winactive
Also justify rounding up font width.
===================================================================
M source/blender/editors/interface/interface_style.c
M source/blender/makesdna/DNA_windowmanager_types.h
===================================================================
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 2a1cdfd447c..92a9f14c77d 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -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;
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index e24d39b61eb..841edaf8724 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -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. */
More information about the Bf-blender-cvs
mailing list