Fix rounding for maximized translucent windows.
This commit is contained in:
parent
8e6811aef0
commit
a3bcd2fac4
2 changed files with 12 additions and 1 deletions
|
|
@ -274,7 +274,9 @@ void WindowHelper::updateCornersRounding() {
|
||||||
if (!::Platform::IsWindows11OrGreater()) {
|
if (!::Platform::IsWindows11OrGreater()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto preference = _isFullScreen ? kDWMWCP_DONOTROUND : kDWMWCP_ROUND;
|
const auto preference = (_isFullScreen || _isMaximizedAndTranslucent)
|
||||||
|
? kDWMWCP_DONOTROUND
|
||||||
|
: kDWMWCP_ROUND;
|
||||||
DwmSetWindowAttribute(
|
DwmSetWindowAttribute(
|
||||||
_handle,
|
_handle,
|
||||||
kDWMWA_WINDOW_CORNER_PREFERENCE,
|
kDWMWA_WINDOW_CORNER_PREFERENCE,
|
||||||
|
|
@ -372,6 +374,14 @@ void WindowHelper::init() {
|
||||||
window()->windowState() & ~Qt::WindowMaximized);
|
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(
|
Ui::Connect(
|
||||||
window()->windowHandle(),
|
window()->windowHandle(),
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ private:
|
||||||
QMargins _marginsDelta;
|
QMargins _marginsDelta;
|
||||||
bool _updatingMargins = false;
|
bool _updatingMargins = false;
|
||||||
bool _isFullScreen = false;
|
bool _isFullScreen = false;
|
||||||
|
bool _isMaximizedAndTranslucent = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue