allow user force use system blur

Signed-off-by: Yuhang Zhao <zhaoyuhang@rankyee.com>
This commit is contained in:
Yuhang Zhao 2023-03-30 14:16:34 +08:00
parent 9e208bb77c
commit b5c9f85f62
4 changed files with 17 additions and 2 deletions

View File

@ -269,7 +269,8 @@ enum class Option
CenterWindowBeforeShow = 5,
EnableBlurBehindWindow = 6,
ForceNonNativeBackgroundBlur = 7,
DisableLazyInitializationForMicaMaterial = 8
DisableLazyInitializationForMicaMaterial = 8,
ForceNativeBackgroundBlur = 9
};
Q_ENUM_NS(Option)

View File

@ -72,7 +72,9 @@ static const struct
{FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_FORCE_NON_NATIVE_BACKGROUND_BLUR"),
FRAMELESSHELPER_BYTEARRAY_LITERAL("Options/ForceNonNativeBackgroundBlur")},
{FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_DISABLE_LAZY_INITIALIZATION_FOR_MICA_MATERIAL"),
FRAMELESSHELPER_BYTEARRAY_LITERAL("Options/DisableLazyInitializationForMicaMaterial")}
FRAMELESSHELPER_BYTEARRAY_LITERAL("Options/DisableLazyInitializationForMicaMaterial")},
{FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_FORCE_NATIVE_BACKGROUND_BLUR"),
FRAMELESSHELPER_BYTEARRAY_LITERAL("Options/ForceNativeBackgroundBlur")}
};
static constexpr const auto OptionCount = std::size(OptionsTable);
@ -107,6 +109,12 @@ static inline void warnInappropriateOptions()
WARNING << "Option::DisableWindowsSnapLayout is only available on Windows.";
}
#endif // Q_OS_WINDOWS
if (cfg->isSet(Option::ForceHideWindowFrameBorder) && cfg->isSet(Option::ForceShowWindowFrameBorder)) {
WARNING << "Option::ForceHideWindowFrameBorder and Option::ForceShowWindowFrameBorder can't be both enabled.";
}
if (cfg->isSet(Option::ForceNonNativeBackgroundBlur) && cfg->isSet(Option::ForceNativeBackgroundBlur)) {
WARNING << "Option::ForceNonNativeBackgroundBlur and Option::ForceNativeBackgroundBlur can't be both enabled.";
}
if (cfg->isSet(Option::WindowUseRoundCorners)) {
WARNING << "Option::WindowUseRoundCorners has not been implemented yet.";
}

View File

@ -530,6 +530,9 @@ WallpaperAspectStyle Utils::getWallpaperAspectStyle()
bool Utils::isBlurBehindWindowSupported()
{
static const auto result = []() -> bool {
if (FramelessConfig::instance()->isSet(Option::ForceNativeBackgroundBlur)) {
return true;
}
if (FramelessConfig::instance()->isSet(Option::ForceNonNativeBackgroundBlur)) {
return false;
}

View File

@ -1968,6 +1968,9 @@ WallpaperAspectStyle Utils::getWallpaperAspectStyle()
bool Utils::isBlurBehindWindowSupported()
{
static const auto result = []() -> bool {
if (FramelessConfig::instance()->isSet(Option::ForceNativeBackgroundBlur)) {
return true;
}
if (FramelessConfig::instance()->isSet(Option::ForceNonNativeBackgroundBlur)) {
return false;
}