Revert "Windows QPA: Remove usage of deprecated DwmEnableBlurBehindWindow"
This reverts commit b07876105788d519a3bb04a353eaa5ffa6269253. Reason for revert: Introduced regression QTBUG-136098 Change-Id: Id1f4d7a485659c4150f6750866c2f702fcdc1bf6 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
e48c19449e
commit
2d0e3c5001
@ -1233,6 +1233,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case QtWindows::CompositionSettingsChanged:
|
case QtWindows::CompositionSettingsChanged:
|
||||||
|
platformWindow->handleCompositionSettingsChanged();
|
||||||
return true;
|
return true;
|
||||||
case QtWindows::ActivateWindowEvent:
|
case QtWindows::ActivateWindowEvent:
|
||||||
if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) {
|
if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) {
|
||||||
|
@ -485,6 +485,22 @@ static inline bool windowIsAccelerated(const QWindow *w)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool applyBlurBehindWindow(HWND hwnd)
|
||||||
|
{
|
||||||
|
DWM_BLURBEHIND blurBehind = {0, 0, nullptr, 0};
|
||||||
|
|
||||||
|
blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
||||||
|
blurBehind.fEnable = TRUE;
|
||||||
|
blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
|
||||||
|
|
||||||
|
const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK;
|
||||||
|
|
||||||
|
if (blurBehind.hRgnBlur)
|
||||||
|
DeleteObject(blurBehind.hRgnBlur);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// from qwidget_win.cpp, pass flags separately in case they have been "autofixed".
|
// from qwidget_win.cpp, pass flags separately in case they have been "autofixed".
|
||||||
static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags)
|
static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags)
|
||||||
{
|
{
|
||||||
@ -1044,6 +1060,8 @@ void WindowCreationData::initialize(const QWindow *w, HWND hwnd, bool frameChang
|
|||||||
|
|
||||||
const bool isAccelerated = windowIsAccelerated(w);
|
const bool isAccelerated = windowIsAccelerated(w);
|
||||||
const bool hasAlpha = w->format().hasAlpha();
|
const bool hasAlpha = w->format().hasAlpha();
|
||||||
|
if (isAccelerated && hasAlpha)
|
||||||
|
applyBlurBehindWindow(hwnd);
|
||||||
setWindowOpacity(hwnd, flags, hasAlpha, isAccelerated, opacityLevel);
|
setWindowOpacity(hwnd, flags, hasAlpha, isAccelerated, opacityLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2096,6 +2114,13 @@ void QWindowsWindow::handleHidden()
|
|||||||
fireExpose(QRegion());
|
fireExpose(QRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWindowsWindow::handleCompositionSettingsChanged()
|
||||||
|
{
|
||||||
|
const QWindow *w = window();
|
||||||
|
if (windowIsAccelerated(w) && w->format().hasAlpha())
|
||||||
|
applyBlurBehindWindow(handle());
|
||||||
|
}
|
||||||
|
|
||||||
qreal QWindowsWindow::dpiRelativeScale(const UINT dpi) const
|
qreal QWindowsWindow::dpiRelativeScale(const UINT dpi) const
|
||||||
{
|
{
|
||||||
return QHighDpiScaling::roundScaleFactor(qreal(dpi) / QWindowsScreen::baseDpi) /
|
return QHighDpiScaling::roundScaleFactor(qreal(dpi) / QWindowsScreen::baseDpi) /
|
||||||
|
@ -295,6 +295,7 @@ public:
|
|||||||
void handleMoved();
|
void handleMoved();
|
||||||
void handleResized(int wParam, LPARAM lParam);
|
void handleResized(int wParam, LPARAM lParam);
|
||||||
void handleHidden();
|
void handleHidden();
|
||||||
|
void handleCompositionSettingsChanged();
|
||||||
void handleDpiScaledSize(WPARAM wParam, LPARAM lParam, LRESULT *result);
|
void handleDpiScaledSize(WPARAM wParam, LPARAM lParam, LRESULT *result);
|
||||||
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||||
void handleDpiChangedAfterParent(HWND hwnd);
|
void handleDpiChangedAfterParent(HWND hwnd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user