Title: [263652] trunk/Source/WebKit
Revision
263652
Author
commit-qu...@webkit.org
Date
2020-06-29 03:19:10 -0700 (Mon, 29 Jun 2020)

Log Message

[GTK] Dark mode for GTK themes that end with -Dark
https://bugs.webkit.org/show_bug.cgi?id=213465

Patch by Elliot <cheesee...@mailo.com> on 2020-06-29
Reviewed by Carlos Garcia Campos.

WebKitGtk has support for automatic detection of dark mode when it comes to GTK themes with the "-dark" and
":dark" suffixes. However, when using GTK themes that end with "-Dark" or ":Dark", this is not the case. This
affects many themes like "Arc" and "Flat-Remix".

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::effectiveAppearanceIsDark const):
(WebKit::PageClientImpl::themeName const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (263651 => 263652)


--- trunk/Source/WebKit/ChangeLog	2020-06-29 10:10:01 UTC (rev 263651)
+++ trunk/Source/WebKit/ChangeLog	2020-06-29 10:19:10 UTC (rev 263652)
@@ -1,3 +1,18 @@
+2020-06-29  Elliot  <cheesee...@mailo.com>
+
+        [GTK] Dark mode for GTK themes that end with -Dark
+        https://bugs.webkit.org/show_bug.cgi?id=213465
+
+        Reviewed by Carlos Garcia Campos.
+
+        WebKitGtk has support for automatic detection of dark mode when it comes to GTK themes with the "-dark" and
+        ":dark" suffixes. However, when using GTK themes that end with "-Dark" or ":Dark", this is not the case. This
+        affects many themes like "Arc" and "Flat-Remix".
+
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
+        (WebKit::PageClientImpl::themeName const):
+
 2020-06-29  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] Add webkit_authentication_request_get_security_origin

Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (263651 => 263652)


--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2020-06-29 10:10:01 UTC (rev 263651)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp	2020-06-29 10:19:10 UTC (rev 263652)
@@ -590,11 +590,11 @@
         return true;
 
     if (auto* themeNameEnv = g_getenv("GTK_THEME"))
-        return g_str_has_suffix(themeNameEnv, "-dark") || g_str_has_suffix(themeNameEnv, ":dark");
+        return g_str_has_suffix(themeNameEnv, "-dark") || g_str_has_suffix(themeNameEnv, "-Dark") || g_str_has_suffix(themeNameEnv, ":dark");
 
     GUniqueOutPtr<char> themeName;
     g_object_get(settings, "gtk-theme-name", &themeName.outPtr(), nullptr);
-    if (g_str_has_suffix(themeName.get(), "-dark"))
+    if (g_str_has_suffix(themeName.get(), "-dark") || (g_str_has_suffix(themeName.get(), "-Dark")))
         return true;
 
     return false;
@@ -617,7 +617,7 @@
 {
     if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
         String name = String::fromUTF8(themeNameEnv);
-        if (name.endsWith("-dark") || name.endsWith(":dark"))
+        if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
             return name.substring(0, name.length() - 5);
         return name;
     }
@@ -625,7 +625,7 @@
     GUniqueOutPtr<char> themeNameSetting;
     g_object_get(gtk_widget_get_settings(m_viewWidget), "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
     String name = String::fromUTF8(themeNameSetting.get());
-    if (name.endsWith("-dark"))
+    if (name.endsWith("-dark") || name.endsWith("-Dark"))
         return name.substring(0, name.length() - 5);
     return name;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to