(cherry picked from commit d99c757d44d7c31fbb0eb290f273ad4d2d464255)
This commit is contained in:
Kirsan 2018-03-30 18:36:31 +03:00 committed by John Preston
parent c1c3b6a7e5
commit 3ff033cdf3
2 changed files with 18 additions and 7 deletions

View file

@ -873,7 +873,9 @@ void MainWindow::updateSystemMenu(Qt::WindowState state) {
}
void MainWindow::psUpdateMargins() {
if (!ps_hWnd) return;
if (!ps_hWnd || _inUpdateMargins) return;
_inUpdateMargins = true;
RECT r, a;
@ -898,13 +900,18 @@ void MainWindow::psUpdateMargins() {
_deltaLeft = w.left - m.left;
_deltaTop = w.top - m.top;
_deltaRight = m.right - w.right;
_deltaBottom = m.bottom - w.bottom;
margins.setLeft(margins.left() - w.left + m.left);
margins.setRight(margins.right() - m.right + w.right);
margins.setBottom(margins.bottom() - m.bottom + w.bottom);
margins.setTop(margins.top() - w.top + m.top);
} else {
_deltaLeft = _deltaTop = 0;
margins.setLeft(margins.left() - _deltaLeft);
margins.setRight(margins.right() - _deltaRight);
margins.setBottom(margins.bottom() - _deltaBottom);
margins.setTop(margins.top() - _deltaTop);
} else if (_deltaLeft != 0 || _deltaTop != 0 || _deltaRight != 0 || _deltaBottom != 0) {
RECT w;
GetWindowRect(ps_hWnd, &w);
SetWindowPos(ps_hWnd, 0, 0, 0, w.right - w.left - _deltaLeft - _deltaRight, w.bottom - w.top - _deltaBottom - _deltaTop, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION);
_deltaLeft = _deltaTop = _deltaRight = _deltaBottom = 0;
}
QPlatformNativeInterface *i = QGuiApplication::platformNativeInterface();
@ -918,6 +925,7 @@ void MainWindow::psUpdateMargins() {
}
}
}
_inUpdateMargins = false;
}
HWND MainWindow::psHwnd() const {

View file

@ -103,6 +103,7 @@ private:
bool _shadowsWorking = false;
bool _themeInited = false;
bool _inUpdateMargins = false;
HWND ps_hWnd = nullptr;
HWND ps_tbHider_hWnd = nullptr;
@ -113,6 +114,8 @@ private:
int _deltaLeft = 0;
int _deltaTop = 0;
int _deltaRight = 0;
int _deltaBottom = 0;
};