Fix rounding for maximized translucent windows.

This commit is contained in:
John Preston 2023-02-10 20:32:06 +04:00
parent 8e6811aef0
commit a3bcd2fac4
2 changed files with 12 additions and 1 deletions

View file

@ -274,7 +274,9 @@ void WindowHelper::updateCornersRounding() {
if (!::Platform::IsWindows11OrGreater()) {
return;
}
auto preference = _isFullScreen ? kDWMWCP_DONOTROUND : kDWMWCP_ROUND;
const auto preference = (_isFullScreen || _isMaximizedAndTranslucent)
? kDWMWCP_DONOTROUND
: kDWMWCP_ROUND;
DwmSetWindowAttribute(
_handle,
kDWMWA_WINDOW_CORNER_PREFERENCE,
@ -372,6 +374,14 @@ void WindowHelper::init() {
window()->windowState() & ~Qt::WindowMaximized);
});
}
if (state != Qt::WindowMinimized) {
const auto is = (state == Qt::WindowMaximized)
&& window()->testAttribute(Qt::WA_TranslucentBackground);
if (_isMaximizedAndTranslucent != is) {
_isMaximizedAndTranslucent = is;
updateCornersRounding();
}
}
};
Ui::Connect(
window()->windowHandle(),

View file

@ -83,6 +83,7 @@ private:
QMargins _marginsDelta;
bool _updatingMargins = false;
bool _isFullScreen = false;
bool _isMaximizedAndTranslucent = false;
};