FluWindowbug修复,qmltypes生成bug修复

This commit is contained in:
jeffrey0326 2024-08-30 23:39:45 +08:00
commit 9716c3c98c
6 changed files with 117 additions and 100 deletions

View File

@ -2261,21 +2261,26 @@ Some contents...</source>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="123"/>
<source>Rounded Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="134"/>
<source>Open Blur Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="158"/>
<location filename="qml/page/T_Theme.qml" line="147"/>
<source>window tintOpacity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="175"/>
<location filename="qml/page/T_Theme.qml" line="164"/>
<source>window blurRadius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="135"/>
<location filename="qml/page/T_Theme.qml" line="180"/>
<source>window effect</source>
<translation type="unfinished"></translation>
</message>

View File

@ -2443,21 +2443,26 @@ Some contents...</source>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="123"/>
<source>Rounded Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="134"/>
<source>Open Blur Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="158"/>
<location filename="qml/page/T_Theme.qml" line="147"/>
<source>window tintOpacity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="175"/>
<location filename="qml/page/T_Theme.qml" line="164"/>
<source>window blurRadius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Theme.qml" line="135"/>
<location filename="qml/page/T_Theme.qml" line="180"/>
<source>window effect</source>
<translation type="unfinished"></translation>
</message>

View File

@ -119,6 +119,17 @@ FluScrollablePage{
FluTheme.animationEnabled = !FluTheme.animationEnabled
}
}
FluText{
text: qsTr("Rounded Window")
Layout.topMargin: 20
}
FluToggleSwitch{
Layout.topMargin: 5
checked: window.roundCornerEnable
onClicked: {
window.roundCornerEnable = !window.roundCornerEnable
}
}
FluText{
text: qsTr("Open Blur Window")
Layout.topMargin: 20

View File

@ -1,5 +1,4 @@
#include "FluFrameless.h"
#include "FluTheme.h"
#include <QQuickWindow>
#include <QGuiApplication>
@ -181,8 +180,6 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
pDwmSetWindowAttribute(hwnd, 1029, &enable, sizeof(enable));
}
}
BOOL isDark = FluTheme::getInstance()->dark();
setWindowDarkMode(hwnd, isDark);
return true;
}
@ -198,8 +195,6 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
const DWORD backdropType = _DWMSBT_AUTO;
pDwmSetWindowAttribute(hwnd, 38, &backdropType, sizeof(backdropType));
}
BOOL isDark = FluTheme::getInstance()->dark();
setWindowDarkMode(hwnd, isDark);
return true;
}
@ -215,8 +210,6 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
const DWORD backdropType = _DWMSBT_AUTO;
pDwmSetWindowAttribute(hwnd, 38, &backdropType, sizeof(backdropType));
}
BOOL isDark = FluTheme::getInstance()->dark();
setWindowDarkMode(hwnd, isDark);
return true;
}
@ -224,8 +217,6 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
if ((isWin7Only() && !isCompositionEnabled()) || !initializeFunctionPointers()) {
return false;
}
BOOL isDark = FluTheme::getInstance()->dark();
setWindowDarkMode(hwnd, isDark && enable);
if (enable) {
if (isWin8OrGreater()) {
ACCENT_POLICY policy{};
@ -295,8 +286,6 @@ FluFrameless::~FluFrameless() = default;
[[maybe_unused]] void FluFrameless::onDestruction() {
QGuiApplication::instance()->removeNativeEventFilter(this);
disconnect(FluTheme::getInstance(), &FluTheme::darkChanged, this, nullptr);
disconnect(window(), &QQuickWindow::screenChanged, this, nullptr);
}
void FluFrameless::componentComplete() {
@ -307,7 +296,7 @@ void FluFrameless::componentComplete() {
} else {
availableEffects({"dwm-blur","normal"});
}
if (!_effect.isEmpty()) {
if (!_effect.isEmpty() && _useSystemEffect) {
effective(setWindowEffect(hwnd, _effect, true));
if (effective()) {
_currentEffect = effect();
@ -323,19 +312,21 @@ void FluFrameless::componentComplete() {
effective(setWindowEffect(hwnd, effect(), true));
if (effective()) {
_currentEffect = effect();
_useSystemEffect = true;
} else {
_effect = "normal";
_currentEffect = "normal";
_useSystemEffect = false;
}
});
connect(FluTheme::getInstance(), &FluTheme::blurBehindWindowEnabledChanged, this, [this] {
if (FluTheme::getInstance()->blurBehindWindowEnabled()) {
connect(this, &FluFrameless::useSystemEffectChanged, this, [this] {
if (!_useSystemEffect) {
effect("normal");
}
});
connect(FluTheme::getInstance(), &FluTheme::darkChanged, this, [hwnd, this] {
connect(this, &FluFrameless::isDarkModeChanged, this, [hwnd, this] {
if (effective() && !_currentEffect.isEmpty() && _currentEffect != "normal") {
setWindowDarkMode(hwnd, FluTheme::getInstance()->dark());
setWindowDarkMode(hwnd, _isDarkMode);
}
});
#endif

View File

@ -117,6 +117,8 @@ class FluFrameless : public QQuickItem, QAbstractNativeEventFilter {
Q_PROPERTY_AUTO(QString, effect)
Q_PROPERTY_READONLY_AUTO(bool, effective)
Q_PROPERTY_READONLY_AUTO(QStringList, availableEffects)
Q_PROPERTY_AUTO(bool, isDarkMode)
Q_PROPERTY_AUTO(bool, useSystemEffect)
QML_NAMED_ELEMENT(FluFrameless)
public:
explicit FluFrameless(QQuickItem *parent = nullptr);
@ -162,6 +164,7 @@ private:
void _setMaximizeHovered(bool val);
private:
quint64 _current = 0;
int _edges = 0;

View File

@ -114,6 +114,8 @@ Window {
fixSize: window.fixSize
topmost: window.stayTop
disabled: FluApp.useSystemAppBar
isDarkMode: FluTheme.dark
useSystemEffect: !FluTheme.blurBehindWindowEnabled
Component.onCompleted: {
frameless.setHitTestVisible(appBar.layoutMacosButtons)
frameless.setHitTestVisible(appBar.layoutStandardbuttons)