win: allow square corner on win11
This commit is contained in:
parent
64a4362580
commit
97112f853f
|
@ -328,7 +328,8 @@ enum class Option : quint8
|
||||||
ForceNonNativeBackgroundBlur,
|
ForceNonNativeBackgroundBlur,
|
||||||
DisableLazyInitializationForMicaMaterial,
|
DisableLazyInitializationForMicaMaterial,
|
||||||
ForceNativeBackgroundBlur,
|
ForceNativeBackgroundBlur,
|
||||||
Last = ForceNativeBackgroundBlur
|
WindowUseSquareCorners,
|
||||||
|
Last = WindowUseSquareCorners
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(Option)
|
Q_ENUM_NS(Option)
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,8 @@ static constexpr const std::array<FramelessConfigEntry, static_cast<int>(Option:
|
||||||
FramelessConfigEntry{ "FRAMELESSHELPER_ENABLE_BLUR_BEHIND_WINDOW", "Options/EnableBlurBehindWindow" },
|
FramelessConfigEntry{ "FRAMELESSHELPER_ENABLE_BLUR_BEHIND_WINDOW", "Options/EnableBlurBehindWindow" },
|
||||||
FramelessConfigEntry{ "FRAMELESSHELPER_FORCE_NON_NATIVE_BACKGROUND_BLUR", "Options/ForceNonNativeBackgroundBlur" },
|
FramelessConfigEntry{ "FRAMELESSHELPER_FORCE_NON_NATIVE_BACKGROUND_BLUR", "Options/ForceNonNativeBackgroundBlur" },
|
||||||
FramelessConfigEntry{ "FRAMELESSHELPER_DISABLE_LAZY_INITIALIZATION_FOR_MICA_MATERIAL", "Options/DisableLazyInitializationForMicaMaterial" },
|
FramelessConfigEntry{ "FRAMELESSHELPER_DISABLE_LAZY_INITIALIZATION_FOR_MICA_MATERIAL", "Options/DisableLazyInitializationForMicaMaterial" },
|
||||||
FramelessConfigEntry{ "FRAMELESSHELPER_FORCE_NATIVE_BACKGROUND_BLUR", "Options/ForceNativeBackgroundBlur" }
|
FramelessConfigEntry{ "FRAMELESSHELPER_FORCE_NATIVE_BACKGROUND_BLUR", "Options/ForceNativeBackgroundBlur" },
|
||||||
|
FramelessConfigEntry{ "FRAMELESSHELPER_WINDOW_USE_SQUARE_CORNERS", "Options/WindowUseSquareCorners" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr const auto OptionCount = std::size(FramelessOptionsTable);
|
static constexpr const auto OptionCount = std::size(FramelessOptionsTable);
|
||||||
|
|
|
@ -261,7 +261,7 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
|
||||||
if (WindowsVersionHelper::isWin10RS5OrGreater()) {
|
if (WindowsVersionHelper::isWin10RS5OrGreater()) {
|
||||||
const bool dark = (FramelessManager::instance()->systemTheme() == SystemTheme::Dark);
|
const bool dark = (FramelessManager::instance()->systemTheme() == SystemTheme::Dark);
|
||||||
const auto isWidget = [params]() -> bool {
|
const auto isWidget = [params]() -> bool {
|
||||||
const auto widget = params->getWidgetHandle();
|
const QObject *widget = params->getWidgetHandle();
|
||||||
return (widget && widget->isWidgetType());
|
return (widget && widget->isWidgetType());
|
||||||
}();
|
}();
|
||||||
if (!isWidget) {
|
if (!isWidget) {
|
||||||
|
@ -270,6 +270,11 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
|
||||||
std::ignore = Utils::updateGlobalWin32ControlsTheme(windowId, dark);
|
std::ignore = Utils::updateGlobalWin32ControlsTheme(windowId, dark);
|
||||||
}
|
}
|
||||||
std::ignore = Utils::refreshWin32ThemeResources(windowId, dark);
|
std::ignore = Utils::refreshWin32ThemeResources(windowId, dark);
|
||||||
|
if (WindowsVersionHelper::isWin11OrGreater()) {
|
||||||
|
if (FramelessConfig::instance()->isSet(Option::WindowUseSquareCorners)) {
|
||||||
|
std::ignore = Utils::setCornerStyleForWindow(windowId, WindowCornerStyle::Square);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue