Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qt6/src/qml/overridable/InWindowBlur.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Item {
D.BackdropBlitter {
id: blitter
anchors.fill: parent
blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur
blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur && D.DTK.isBlurBackendSupported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要是没有opengl,就用software渲染,这个应该就够了,不用加isBlurBackendSupported吧,


MultiEffect {
id: blur
Expand Down
15 changes: 15 additions & 0 deletions src/private/dqmlglobalobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,21 @@ bool DQMLGlobalObject::isSoftwareRender()
return isSoftware;
}

// Check whether the current scene graph backend supports InWindowBlur rendering.
// The blur effect requires the OpenGL RHI backend; other backends (e.g. Vulkan,
// Metal, D3D11) are not supported by DBackdropNode's RHI render path and would
// silently fall back to a no-op (reset), leaving a semi-transparent background
// without actual blur. This is distinct from isSoftwareRender(), which only
// detects the explicit "software" backend string.
bool DQMLGlobalObject::isBlurBackendSupported()
{
static bool supported = []() {
const QString backend = QQuickWindow::sceneGraphBackend();
return backend.isEmpty() || backend == QLatin1String("opengl");
}();
return supported;
}

QString DQMLGlobalObject::windowManagerNameString() const
{
return DWindowManagerHelper::instance()->windowManagerNameString();
Expand Down
2 changes: 2 additions & 0 deletions src/private/dqmlglobalobject_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class DQMLGlobalObject : public QObject, public DTK_CORE_NAMESPACE::DObject
Q_PROPERTY(bool hasAnimation READ hasAnimation NOTIFY hasAnimationChanged)
Q_PROPERTY(bool hasInWindowBlur READ hasInWindowBlur NOTIFY hasInWindowBlurChanged)
Q_PROPERTY(bool isSoftwareRender READ isSoftwareRender FINAL CONSTANT)
Q_PROPERTY(bool isBlurBackendSupported READ isBlurBackendSupported FINAL CONSTANT)
Q_PROPERTY(DTK_GUI_NAMESPACE::DWindowManagerHelper::WMName windowManagerName READ windowManagerName CONSTANT)
Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType READ themeType NOTIFY themeTypeChanged)
Q_PROPERTY(QString windowManagerNameString READ windowManagerNameString CONSTANT)
Expand Down Expand Up @@ -188,6 +189,7 @@ class DQMLGlobalObject : public QObject, public DTK_CORE_NAMESPACE::DObject
static bool hasAnimation();
static bool hasInWindowBlur();
static bool isSoftwareRender();
static bool isBlurBackendSupported();

DWindowManagerHelper::WMName windowManagerName() const;
QString windowManagerNameString() const;
Expand Down
Loading