Fix window shadow after native frame switch.
This commit is contained in:
parent
7f15ac5f0e
commit
5c0066958b
2 changed files with 14 additions and 0 deletions
|
|
@ -178,11 +178,22 @@ void WindowHelper::setNativeFrame(bool enabled) {
|
||||||
} else {
|
} else {
|
||||||
_shadow.emplace(window(), st::windowShadowFg->c);
|
_shadow.emplace(window(), st::windowShadowFg->c);
|
||||||
_shadow->setResizeEnabled(!fixedSize());
|
_shadow->setResizeEnabled(!fixedSize());
|
||||||
|
initialShadowUpdate();
|
||||||
}
|
}
|
||||||
updateMargins();
|
updateMargins();
|
||||||
fixMaximizedWindow();
|
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) {
|
void WindowHelper::setMinimumSize(QSize size) {
|
||||||
window()->setMinimumSize(size.width(), titleHeight() + size.height());
|
window()->setMinimumSize(size.width(), titleHeight() + size.height());
|
||||||
}
|
}
|
||||||
|
|
@ -265,6 +276,8 @@ void WindowHelper::init() {
|
||||||
window()->windowHandle(),
|
window()->windowHandle(),
|
||||||
&QWindow::windowStateChanged,
|
&QWindow::windowStateChanged,
|
||||||
handleStateChanged);
|
handleStateChanged);
|
||||||
|
|
||||||
|
initialShadowUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowHelper::handleNativeEvent(
|
bool WindowHelper::handleNativeEvent(
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ private:
|
||||||
void updateMargins();
|
void updateMargins();
|
||||||
void updateSystemMenu();
|
void updateSystemMenu();
|
||||||
void updateSystemMenu(Qt::WindowState state);
|
void updateSystemMenu(Qt::WindowState state);
|
||||||
|
void initialShadowUpdate();
|
||||||
void fixMaximizedWindow();
|
void fixMaximizedWindow();
|
||||||
[[nodiscard]] bool handleNativeEvent(
|
[[nodiscard]] bool handleNativeEvent(
|
||||||
UINT msg,
|
UINT msg,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue