[vlc-commits] [Git][videolan/vlc][master] qt: apply blur behind effect when the target window is activated

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Oct 27 18:56:52 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
b1e11641 by Fatih Uzunoglu at 2024-10-27T18:36:16+00:00
qt: apply blur behind effect when the target window is activated

Currently, the effect is applied before the window is shown. Frankly,
there is no restriction from the compositors side (DWM, KWin) regarding
when the backdrop blur effect can be activated, and it was a courtesy
for the compositors to request the effect even before the window is shown
so that they could do the job potentially better.

For us, it does not matter much when the blur is applied. However,
with KWin Wayland it does not seem to be possible to use effects before
the window is shown. It is not clear if this is a KWin regression, but
since it does not matter, the blur can be requested when the window is
activated.

- - - - -


4 changed files:

- modules/gui/qt/maininterface/compositor.cpp
- modules/gui/qt/maininterface/compositor.hpp
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_x11.cpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor.cpp
=====================================
@@ -272,7 +272,16 @@ bool CompositorVideo::commonGUICreateImpl(QWindow* window, CompositorVideo::Flag
     }
     if (!backendIsOpenVg && (flags & CompositorVideo::HAS_ACRYLIC))
     {
-        setBlurBehind(window, true);
+        if (Q_LIKELY(!window->isActive()))
+        {
+            connect(window, &QWindow::activeChanged, this, [this, window = QPointer(window)]() {
+               setBlurBehind(window, true);
+            }, Qt::SingleShotConnection);
+        }
+        else
+        {
+            setBlurBehind(window, true);
+        }
     }
     m_videoWindowHandler = std::make_unique<VideoWindowHandler>(m_intf);
     m_videoWindowHandler->setWindow( window );
@@ -282,7 +291,6 @@ bool CompositorVideo::commonGUICreateImpl(QWindow* window, CompositorVideo::Flag
 #else
     m_interfaceWindowHandler = std::make_unique<InterfaceWindowHandler>(m_intf, m_mainCtx, window);
 #endif
-    m_mainCtx->setHasAcrylicSurface(m_blurBehind);
     m_mainCtx->setWindowSuportExtendedFrame(flags & CompositorVideo::HAS_EXTENDED_FRAME);
 
 #ifdef _WIN32
@@ -376,6 +384,6 @@ bool CompositorVideo::setBlurBehind(QWindow *window, const bool enable)
         return false;
 
     m_windowEffectsModule->setBlurBehind(window, enable);
-    m_blurBehind = enable;
+    m_mainCtx->setHasAcrylicSurface(enable);
     return true;
 }


=====================================
modules/gui/qt/maininterface/compositor.hpp
=====================================
@@ -187,7 +187,6 @@ protected:
     std::unique_ptr<WinTaskbarWidget> m_taskbarWidget;
 #endif
 
-    bool m_blurBehind = false;
     WindowEffectsModule* m_windowEffectsModule = nullptr;
     bool m_failedToLoadWindowEffectsModule = false;
 };


=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -213,7 +213,7 @@ void CompositorDirectComposition::setup()
 
     m_dcompDevice->Commit();
 
-    if (!m_blurBehind)
+    if (!m_mainCtx->hasAcrylicSurface())
     {
         if (var_InheritBool(m_intf, "qt-backdrop-blur"))
         {


=====================================
modules/gui/qt/maininterface/compositor_x11.cpp
=====================================
@@ -209,7 +209,7 @@ bool CompositorX11::makeMainInterface(MainCtx* mainCtx)
 
     m_qmlView->show();
 
-    if (m_blurBehind)
+    if (m_mainCtx->hasAcrylicSurface())
         m_renderWindow->m_hasAcrylic = true;
 
     m_renderWindow->setInterfaceWindow(m_qmlView.get());



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b1e1164154c80a1da9c30bf2a50ebc2b2c5e6ad1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b1e1164154c80a1da9c30bf2a50ebc2b2c5e6ad1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list