[vlc-commits] [Git][videolan/vlc][master] qt: add preference `qt-backdrop-blur`

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 20 18:14:37 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d33cfe3b by Fatih Uzunoglu at 2024-07-20T17:53:59+00:00
qt: add preference `qt-backdrop-blur`

This setting makes it possible to disable the
backdrop blur filter for the main window.

Apart from accessibility reasons, having this
setting enabled makes text being rendered in
worse quality since Qt's sub-pixel rendering
is impaired by translucency, which is a
requirement for exposing backdrop effects in
the UI layer.

In order to align with the proposed design,
this setting is enabled by default.

- - - - -


3 changed files:

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


Changes:

=====================================
modules/gui/qt/maininterface/compositor.cpp
=====================================
@@ -326,6 +326,14 @@ bool CompositorVideo::setBlurBehind(QWindow *window, const bool enable)
     assert(window);
     assert(m_intf);
 
+    if (enable)
+    {
+        if (!var_InheritBool(m_intf, "qt-backdrop-blur"))
+        {
+            return false;
+        }
+    }
+
     if (m_failedToLoadWindowEffectsModule)
         return false;
 


=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -194,15 +194,18 @@ void CompositorDirectComposition::setup()
 
     if (!m_blurBehind)
     {
-        try
+        if (var_InheritBool(m_intf, "qt-backdrop-blur"))
         {
-            m_acrylicSurface = new CompositorDCompositionAcrylicSurface(m_intf, this, m_mainCtx, m_dcompDevice);
-        }
-        catch (const std::exception& exception)
-        {
-            if (const auto what = exception.what())
-                msg_Warn(m_intf, "%s", what);
-            delete m_acrylicSurface.data();
+            try
+            {
+                m_acrylicSurface = new CompositorDCompositionAcrylicSurface(m_intf, this, m_mainCtx, m_dcompDevice);
+            }
+            catch (const std::exception& exception)
+            {
+                if (const auto what = exception.what())
+                    msg_Warn(m_intf, "%s", what);
+                delete m_acrylicSurface.data();
+            }
         }
     }
 }


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -259,6 +259,10 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define HIDE_WINDOW_ON_CLOSE_TEXT N_( "Hide the window on close" )
 #define HIDE_WINDOW_ON_CLOSE_LONGTEXT N_( "Instead of closing the application, hide the window. This setting is only applicable when system tray icon is enabled." )
 
+#define BACKDROP_BLUR_FILTER_TEXT N_( "Enable backdrop blur filter for the main window if possible" )
+#define BACKDROP_BLUR_FILTER_LONGTEXT N_( "If backdrop blur filter is available, use translucency in the backgrounds of certain parts of the user interface " \
+    "instead of a solid color. This setting impairs readibility of text." )
+
 static const int initial_prefs_view_list[] = { 0, 1, 2 };
 static const char *const initial_prefs_view_list_texts[] =
     { N_("Simple"), N_("Advanced"), N_("Expert") };
@@ -435,6 +439,8 @@ vlc_module_begin ()
 
     add_bool( "qt-close-to-system-tray", false, HIDE_WINDOW_ON_CLOSE_TEXT, HIDE_WINDOW_ON_CLOSE_LONGTEXT )
 
+    add_bool( "qt-backdrop-blur", true, BACKDROP_BLUR_FILTER_TEXT, BACKDROP_BLUR_FILTER_LONGTEXT )
+
     add_float_with_range( "qt-safe-area", 0, 0, 100.0, SAFE_AREA_TEXT, SAFE_AREA_LONGTEXT )
 
     cannot_unload_broken_library()



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d33cfe3be57d00aac84f9b0080df08911604abca
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