forked from github_mirror/framelesshelper
Fix direct link build for WNEF.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
e1656a9636
commit
c95e8fc806
|
@ -2306,42 +2306,37 @@ bool WinNativeEventFilter::setAcrylicEffectEnabled(void *handle, const bool enab
|
||||||
Q_ASSERT(handle);
|
Q_ASSERT(handle);
|
||||||
const auto hwnd = reinterpret_cast<HWND>(handle);
|
const auto hwnd = reinterpret_cast<HWND>(handle);
|
||||||
if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, hwnd)) {
|
if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, hwnd)) {
|
||||||
DWM_BLURBEHIND dwmBB;
|
if (isWin8OrGreater() && coreData()->m_lpSetWindowCompositionAttribute) {
|
||||||
SecureZeroMemory(&dwmBB, sizeof(dwmBB));
|
ACCENT_POLICY accentPolicy;
|
||||||
dwmBB.dwFlags = DWM_BB_ENABLE;
|
SecureZeroMemory(&accentPolicy, sizeof(accentPolicy));
|
||||||
ACCENT_POLICY accentPolicy;
|
WINDOWCOMPOSITIONATTRIBDATA wcaData;
|
||||||
SecureZeroMemory(&accentPolicy, sizeof(accentPolicy));
|
SecureZeroMemory(&wcaData, sizeof(wcaData));
|
||||||
WINDOWCOMPOSITIONATTRIBDATA wcaData;
|
wcaData.Attrib = WCA_ACCENT_POLICY;
|
||||||
SecureZeroMemory(&wcaData, sizeof(wcaData));
|
wcaData.pvData = &accentPolicy;
|
||||||
wcaData.Attrib = WCA_ACCENT_POLICY;
|
wcaData.cbData = sizeof(accentPolicy);
|
||||||
wcaData.pvData = &accentPolicy;
|
if (enabled) {
|
||||||
wcaData.cbData = sizeof(accentPolicy);
|
if (isWin10OrGreater(17134)) {
|
||||||
if (enabled) {
|
// Windows 10, version 1803 (10.0.17134)
|
||||||
if (isWin10OrGreater(17134)) {
|
// It's not allowed to enable the Acrylic effect for Win32
|
||||||
// Windows 10, version 1803 (10.0.17134)
|
// applications until Win10 1803.
|
||||||
// It's not allowed to enable the Acrylic effect for Win32
|
accentPolicy.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
|
||||||
// applications until Win10 1803.
|
} else if (isWin10OrGreater(10240)) {
|
||||||
accentPolicy.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
|
// Windows 10, version 1507 (10.0.10240)
|
||||||
} else if (isWin10OrGreater(10240)) {
|
// The initial version of Win10.
|
||||||
// Windows 10, version 1507 (10.0.10240)
|
accentPolicy.AccentState = ACCENT_ENABLE_BLURBEHIND;
|
||||||
// The initial version of Win10.
|
} else {
|
||||||
accentPolicy.AccentState = ACCENT_ENABLE_BLURBEHIND;
|
// Windows 8 and 8.1.
|
||||||
} else if (isWin8OrGreater()) {
|
accentPolicy.AccentState = ACCENT_ENABLE_TRANSPARENTGRADIENT;
|
||||||
accentPolicy.AccentState = ACCENT_ENABLE_TRANSPARENTGRADIENT;
|
}
|
||||||
} else {
|
} else {
|
||||||
// Windows 7
|
|
||||||
dwmBB.fEnable = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isWin8OrGreater()) {
|
|
||||||
accentPolicy.AccentState = ACCENT_DISABLED;
|
accentPolicy.AccentState = ACCENT_DISABLED;
|
||||||
} else {
|
|
||||||
dwmBB.fEnable = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
return coreData()->m_lpSetWindowCompositionAttribute(hwnd, &wcaData);
|
||||||
if (isWin8OrGreater()) {
|
|
||||||
return WNEF_EXECUTE_WINAPI_RETURN(SetWindowCompositionAttribute, FALSE, hwnd, &wcaData);
|
|
||||||
} else {
|
} else {
|
||||||
|
DWM_BLURBEHIND dwmBB;
|
||||||
|
SecureZeroMemory(&dwmBB, sizeof(dwmBB));
|
||||||
|
dwmBB.dwFlags = DWM_BB_ENABLE;
|
||||||
|
dwmBB.fEnable = enabled ? TRUE : FALSE;
|
||||||
return SUCCEEDED(
|
return SUCCEEDED(
|
||||||
WNEF_EXECUTE_WINAPI_RETURN(DwmEnableBlurBehindWindow, E_FAIL, hwnd, &dwmBB));
|
WNEF_EXECUTE_WINAPI_RETURN(DwmEnableBlurBehindWindow, E_FAIL, hwnd, &dwmBB));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue