mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-13 07:33:53 +08:00
.
This commit is contained in:
parent
4e401a387e
commit
236ce03fff
@ -144,13 +144,22 @@ DECLARE_API bool clearEffect(HWND hwnd)
|
||||
}
|
||||
uint32_t GetOSversion() noexcept;
|
||||
|
||||
DECLARE_API bool setbackdropX(HWND hwnd, bool corner, bool dark)
|
||||
DECLARE_API bool setbackdropX(HWND hwnd, bool good, bool dark)
|
||||
{
|
||||
#ifndef WINXP
|
||||
if (GetOSversion() <= 6)
|
||||
return false;
|
||||
ACCENT_POLICY accent;
|
||||
accent.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
|
||||
|
||||
DWORD corner_ = good ? 2 : 0;
|
||||
DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_, sizeof(corner_));
|
||||
|
||||
common if (!good)
|
||||
{
|
||||
|
||||
accentPolicy.AccentState = ACCENT_DISABLED;
|
||||
return setWindowCompositionAttribute(hwnd, &winCompAttrData);
|
||||
}
|
||||
accentPolicy.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
|
||||
|
||||
CRegKey key;
|
||||
if (ERROR_SUCCESS != key.Open(HKEY_CURRENT_USER, LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent)"))
|
||||
@ -159,27 +168,17 @@ DECLARE_API bool setbackdropX(HWND hwnd, bool corner, bool dark)
|
||||
if (ERROR_SUCCESS != key.QueryDWORDValue(L"AccentColorMenu", accent_int))
|
||||
return false;
|
||||
if (dark)
|
||||
accent.GradientColor = 0x40212121;
|
||||
accentPolicy.GradientColor = 0x40212121;
|
||||
else
|
||||
accent.GradientColor = 0x40f7f7fa;
|
||||
WINDOWCOMPOSITIONATTRIBDATA data;
|
||||
data.Attrib = WCA_ACCENT_POLICY;
|
||||
data.cbData = sizeof(accent);
|
||||
data.pvData = &accent;
|
||||
auto setWindowCompositionAttribute = (pfnSetWindowCompositionAttribute)GetProcAddress(GetModuleHandle(L"user32.dll"), "SetWindowCompositionAttribute");
|
||||
if (!setWindowCompositionAttribute)
|
||||
return false;
|
||||
setWindowCompositionAttribute(hwnd, &data);
|
||||
accentPolicy.GradientColor = 0x40f7f7fa;
|
||||
setWindowCompositionAttribute(hwnd, &winCompAttrData);
|
||||
|
||||
if (dark)
|
||||
{
|
||||
data.Attrib = WCA_USEDARKMODECOLORS;
|
||||
setWindowCompositionAttribute(hwnd, &data);
|
||||
winCompAttrData.Attrib = WCA_USEDARKMODECOLORS;
|
||||
setWindowCompositionAttribute(hwnd, &winCompAttrData);
|
||||
}
|
||||
|
||||
DWORD corner_ = corner ? 2 : 0;
|
||||
DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_, sizeof(corner_));
|
||||
|
||||
return true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
@ -970,9 +970,7 @@ class MAINUI:
|
||||
if ismenulist:
|
||||
darklight = ["light", "dark"][self.currentisdark]
|
||||
name = globalconfig[darklight + "theme2"]
|
||||
if name == "QTWin11":
|
||||
# 这个东西会导致其他主题看起来很怪,而且没办法撤销
|
||||
winsharedutils.setbackdropX(int(widget.winId()), True, dark)
|
||||
winsharedutils.setbackdropX(int(widget.winId()), name == "QTWin11", dark)
|
||||
|
||||
@threader
|
||||
def clickwordcallback(self, word, append=False):
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0ccbf59b08fd7458820ede53833a8968e93b0d0c
|
||||
Subproject commit 82812f0105b32b4cd6f28f2caa292f57c6af00c3
|
Loading…
x
Reference in New Issue
Block a user