diff --git a/modules/gui/qt/maininterface/compositor.cpp b/modules/gui/qt/maininterface/compositor.cpp index ba49b4cd62..926f63bf46 100644 --- a/modules/gui/qt/maininterface/compositor.cpp +++ b/modules/gui/qt/maininterface/compositor.cpp @@ -381,7 +381,7 @@ bool CompositorVideo::setBlurBehind(QWindow *window, const bool enable) } } - if (!m_windowEffectsModule->isEffectAvailable(WindowEffectsModule::BlurBehind)) + if (!m_windowEffectsModule->isEffectAvailable(window, WindowEffectsModule::BlurBehind)) return false; m_windowEffectsModule->setBlurBehind(window, enable); diff --git a/modules/gui/qt/maininterface/kwindowsystem_module.cpp b/modules/gui/qt/maininterface/kwindowsystem_module.cpp index 49802342f0..435190f35a 100644 --- a/modules/gui/qt/maininterface/kwindowsystem_module.cpp +++ b/modules/gui/qt/maininterface/kwindowsystem_module.cpp @@ -23,7 +23,7 @@ #include -static bool isEffectAvailable(const WindowEffectsModule::Effect effect) +static bool isEffectAvailable(const QWindow*, const WindowEffectsModule::Effect effect) { KWindowEffects::Effect kWindowEffect; @@ -54,7 +54,7 @@ static int Open(vlc_object_t* const p_this) // In that case, simply fail here, // so that another potentially compatible // module can be loaded instead: - if (!isEffectAvailable(WindowEffectsModule::BlurBehind)) + if (!isEffectAvailable(nullptr, WindowEffectsModule::BlurBehind)) return VLC_EGENERIC; const auto obj = reinterpret_cast(p_this); diff --git a/modules/gui/qt/maininterface/win32windoweffects_module.cpp b/modules/gui/qt/maininterface/win32windoweffects_module.cpp index b85b00b799..e5b65af309 100644 --- a/modules/gui/qt/maininterface/win32windoweffects_module.cpp +++ b/modules/gui/qt/maininterface/win32windoweffects_module.cpp @@ -25,12 +25,34 @@ #include -static bool isEffectAvailable(const WindowEffectsModule::Effect effect) +static bool isEffectAvailable(const QWindow* window, const WindowEffectsModule::Effect effect) { // Version check is done on module open, no need to re-do it here. switch (effect) { case WindowEffectsModule::BlurBehind: + // NOTE: Qt does not officially support translucent window with frame. + // The documentation states that `Qt::FramelessWindowHint` is + // required on certain platforms, such as Windows. Otherwise, + // The window starts with a white background, which is a widely + // known Windows issue regardless of translucency, but the white + // background is never cleared if the window clear color is + // translucent. In this case, minimizing and restoring the window + // makes the background cleared, but this still does not make + // it a portable solution. + // NOTE: See QTBUG-56201, QTBUG-120691. From the reports, it appears + // that Nvidia graphics is "fine" with translucent framed window + // while Intel graphics is not. However, the said issue above + // is still a concern with Nvidia graphics according to my own + // experience. + // TODO: Ideally, we should at least use the frameless window hint + // when CSD is in use and use native backdrop effect since + // the custom solution has more chance to cause issues. + if (!window->flags().testFlag(Qt::FramelessWindowHint)) + { + qDebug("Target window is not frameless, window can not be translucent for the Windows 11 22H2 native acrylic backdrop effect."); + return false; + } return true; default: return false; diff --git a/modules/gui/qt/maininterface/windoweffects_module.hpp b/modules/gui/qt/maininterface/windoweffects_module.hpp index bd0c17f02c..ca88b78efc 100644 --- a/modules/gui/qt/maininterface/windoweffects_module.hpp +++ b/modules/gui/qt/maininterface/windoweffects_module.hpp @@ -33,7 +33,7 @@ struct WindowEffectsModule module_t *p_module = nullptr; void *p_sys = nullptr; - bool (*isEffectAvailable)(Effect effect); + bool (*isEffectAvailable)(const QWindow* window, Effect effect); void (*setBlurBehind)(QWindow* window, bool enable); };