Browse Source

Ensure non-first top-level-widgets have a valid size on start

Signed-off-by: falkTX <falktx@falktx.com>
pull/409/head
falkTX 3 years ago
parent
commit
ec2862546a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      dgl/src/TopLevelWidgetPrivateData.cpp

+ 11
- 0
dgl/src/TopLevelWidgetPrivateData.cpp View File

@@ -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);
}



Loading…
Cancel
Save