Fix window shadow after native frame switch.

This commit is contained in:
John Preston 2021-08-10 13:12:21 +03:00
parent 7f15ac5f0e
commit 5c0066958b
2 changed files with 14 additions and 0 deletions

View file

@ -178,11 +178,22 @@ void WindowHelper::setNativeFrame(bool enabled) {
} else {
_shadow.emplace(window(), st::windowShadowFg->c);
_shadow->setResizeEnabled(!fixedSize());
initialShadowUpdate();
}
updateMargins();
fixMaximizedWindow();
}
void WindowHelper::initialShadowUpdate() {
using Change = WindowShadow::Change;
const auto noShadowStates = (Qt::WindowMinimized | Qt::WindowMaximized);
if ((window()->windowState() & noShadowStates) || window()->isHidden()) {
_shadow->update(Change::Hidden);
} else {
_shadow->update(Change::Moved | Change::Resized | Change::Shown);
}
}
void WindowHelper::setMinimumSize(QSize size) {
window()->setMinimumSize(size.width(), titleHeight() + size.height());
}
@ -265,6 +276,8 @@ void WindowHelper::init() {
window()->windowHandle(),
&QWindow::windowStateChanged,
handleStateChanged);
initialShadowUpdate();
}
bool WindowHelper::handleNativeEvent(

View file

@ -39,6 +39,7 @@ private:
void updateMargins();
void updateSystemMenu();
void updateSystemMenu(Qt::WindowState state);
void initialShadowUpdate();
void fixMaximizedWindow();
[[nodiscard]] bool handleNativeEvent(
UINT msg,