fix(windows): wait for Qt before getting bounds (#5478)
This commit is contained in:
@@ -240,7 +240,7 @@ BaseWindow::BaseWindow(FlagsEnum<Flags> _flags, QWidget *parent)
|
||||
#ifdef USEWINSDK
|
||||
this->useNextBounds_.setSingleShot(true);
|
||||
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this, [this]() {
|
||||
this->currentBounds_ = this->nextBounds_;
|
||||
this->currentBounds_ = this->geometry();
|
||||
});
|
||||
#endif
|
||||
|
||||
@@ -1137,7 +1137,11 @@ bool BaseWindow::handleSIZE(MSG *msg)
|
||||
|
||||
if (this->isNotMinimizedOrMaximized_)
|
||||
{
|
||||
this->currentBounds_ = this->geometry();
|
||||
// Wait for WM_SIZE to be processed by Qt and update the current
|
||||
// bounds afterwards.
|
||||
postToThread([this] {
|
||||
this->currentBounds_ = this->geometry();
|
||||
});
|
||||
}
|
||||
this->useNextBounds_.stop();
|
||||
|
||||
@@ -1166,7 +1170,8 @@ bool BaseWindow::handleMOVE(MSG *msg)
|
||||
#ifdef USEWINSDK
|
||||
if (this->isNotMinimizedOrMaximized_)
|
||||
{
|
||||
this->nextBounds_ = this->geometry();
|
||||
// Wait for WM_SIZE (in case the window was maximized, we don't want to
|
||||
// save the bounds but keep the old ones)
|
||||
this->useNextBounds_.start(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user