Changeset 263652 in webkit


Ignore:
Timestamp:
Jun 29, 2020 3:19:10 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Elliot <CheeseEBoi@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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r263645 r263652  
     12020-06-29  Elliot  <CheeseEBoi@mailo.com>
     2
     3        [GTK] Dark mode for GTK themes that end with -Dark
     4        https://bugs.webkit.org/show_bug.cgi?id=213465
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        WebKitGtk has support for automatic detection of dark mode when it comes to GTK themes with the "-dark" and
     9        ":dark" suffixes. However, when using GTK themes that end with "-Dark" or ":Dark", this is not the case. This
     10        affects many themes like "Arc" and "Flat-Remix".
     11
     12        * UIProcess/API/gtk/PageClientImpl.cpp:
     13        (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
     14        (WebKit::PageClientImpl::themeName const):
     15
    1162020-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
    217
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp

    r262680 r263652  
    591591
    592592    if (auto* themeNameEnv = g_getenv("GTK_THEME"))
    593         return g_str_has_suffix(themeNameEnv, "-dark") || g_str_has_suffix(themeNameEnv, ":dark");
     593        return g_str_has_suffix(themeNameEnv, "-dark") || g_str_has_suffix(themeNameEnv, "-Dark") || g_str_has_suffix(themeNameEnv, ":dark");
    594594
    595595    GUniqueOutPtr<char> themeName;
    596596    g_object_get(settings, "gtk-theme-name", &themeName.outPtr(), nullptr);
    597     if (g_str_has_suffix(themeName.get(), "-dark"))
     597    if (g_str_has_suffix(themeName.get(), "-dark") || (g_str_has_suffix(themeName.get(), "-Dark")))
    598598        return true;
    599599
     
    618618    if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
    619619        String name = String::fromUTF8(themeNameEnv);
    620         if (name.endsWith("-dark") || name.endsWith(":dark"))
     620        if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
    621621            return name.substring(0, name.length() - 5);
    622622        return name;
     
    626626    g_object_get(gtk_widget_get_settings(m_viewWidget), "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
    627627    String name = String::fromUTF8(themeNameSetting.get());
    628     if (name.endsWith("-dark"))
     628    if (name.endsWith("-dark") || name.endsWith("-Dark"))
    629629        return name.substring(0, name.length() - 5);
    630630    return name;
Note: See TracChangeset for help on using the changeset viewer.