commit ec2862546a3613190e5dadf939efb6e4deff41fe parent 594a280c3da97afefd0a4a1bb824aa919aa64a0c Author: falkTX <falktx@falktx.com> Date: Sun, 30 Oct 2022 21:26:01 +0000 Ensure non-first top-level-widgets have a valid size on start Signed-off-by: falkTX <falktx@falktx.com> Diffstat:
M | dgl/src/TopLevelWidgetPrivateData.cpp | | | 11 | +++++++++++ |
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/dgl/src/TopLevelWidgetPrivateData.cpp b/dgl/src/TopLevelWidgetPrivateData.cpp @@ -28,6 +28,17 @@ TopLevelWidget::PrivateData::PrivateData(TopLevelWidget* const s, Window& w) selfw(s), window(w) { + /* if window already has a top-level-widget, make the new one match the first one in size + * this is needed because window creation and resize is a synchronous operation in some systems. + * as such, there's a chance the non-1st top-level-widgets would never get a valid size. + */ + if (!window.pData->topLevelWidgets.empty()) + { + TopLevelWidget* const first = window.pData->topLevelWidgets.front(); + + selfw->pData->size = first->getSize(); + } + window.pData->topLevelWidgets.push_back(self); }