Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
win: minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwenx190 committed Sep 28, 2023
1 parent 27a9e08 commit 8f98ab8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions include/FramelessHelper/Core/framelesshelper_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ using ACCENT_STATE = enum ACCENT_STATE
using ACCENT_FLAG = enum ACCENT_FLAG
{
ACCENT_NONE = 0,
ACCENT_ENABLE_LUMINOSITY = 1 << 1,
ACCENT_ENABLE_ACRYLIC = 1,
ACCENT_ENABLE_MICA = 1 << 1,
ACCENT_ENABLE_BORDER_LEFT = 1 << 5,
ACCENT_ENABLE_BORDER_TOP = 1 << 6,
ACCENT_ENABLE_BORDER_RIGHT = 1 << 7,
Expand All @@ -790,8 +791,8 @@ using ACCENT_FLAG = enum ACCENT_FLAG

using ACCENT_POLICY = struct ACCENT_POLICY
{
ACCENT_STATE AccentState;
ACCENT_FLAG AccentFlags;
DWORD AccentState;
DWORD AccentFlags;
DWORD dwGradientColor; // #AABBGGRR
DWORD dwAnimationId;
};
Expand Down
4 changes: 4 additions & 0 deletions src/core/framelesshelper_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,11 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
// Windows, which means only the top level windows can be scaled to the correct
// size, we of course don't want such thing from happening.
std::ignore = Utils::fixupChildWindowsDpiMessage(windowId);
#if 0 // Conflicts with our blur mode setting.
if (Utils::isWindowAccelerated(window) && Utils::isWindowTransparent(window)) {
std::ignore = Utils::updateFramebufferTransparency(windowId);
}
#endif
if (WindowsVersionHelper::isWin10RS1OrGreater()) {
// Tell DWM we may need dark theme non-client area (title bar & frame border).
FramelessHelperEnableThemeAware();
Expand Down Expand Up @@ -1267,11 +1269,13 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
}
}

#if 0 // Conflicts with our blur mode setting.
if ((uMsg == WM_DWMCOMPOSITIONCHANGED) || (uMsg == WM_DWMCOLORIZATIONCOLORCHANGED)) {
if (Utils::isWindowAccelerated(window) && Utils::isWindowTransparent(window)) {
std::ignore = Utils::updateFramebufferTransparency(windowId);
}
}
#endif

const bool wallpaperChanged = ((uMsg == WM_SETTINGCHANGE) && (wParam == SPI_SETDESKWALLPAPER));
bool systemThemeChanged = ((uMsg == WM_THEMECHANGED) || (uMsg == WM_SYSCOLORCHANGE)
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ quint32 Utils::defaultScreenDpi()
QColor Utils::getAccentColor()
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
return QGuiApplication::palette().color(QPalette::AccentColor);
return QGuiApplication::palette().color(QPalette::Accent);
#else // (QT_VERSION < QT_VERSION_CHECK(6, 6, 0))
# ifdef Q_OS_WINDOWS
return getAccentColor_windows();
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,13 +2454,13 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
SecureZeroMemory(&policy, sizeof(policy));
if (blurMode == BlurMode::Windows_Acrylic) {
policy.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
policy.AccentFlags = ACCENT_ENABLE_LUMINOSITY;
policy.AccentFlags = ACCENT_ENABLE_ACRYLIC; // Mica: ACCENT_ENABLE_MICA | ACCENT_ENABLE_BORDER
const auto gradientColor = [&color]() -> QColor {
if (color.isValid()) {
return color;
}
QColor clr = ((FramelessManager::instance()->systemTheme() == SystemTheme::Dark) ? kDefaultSystemDarkColor : kDefaultSystemLightColor);
clr.setAlphaF(0.9f);
clr.setAlphaF(0.5f);
return clr;
}();
// This API expects the #AABBGGRR format.
Expand Down

0 comments on commit 8f98ab8

Please sign in to comment.