RESOLVED FIXED 202276
[GTK] Fix logic of dark theme detection
https://bugs.webkit.org/show_bug.cgi?id=202276
Summary [GTK] Fix logic of dark theme detection
Patrick Griffis
Reported 2019-09-26 10:13:28 PDT
[GTK] Fix logic of dark theme detection
Attachments
Patch (1.74 KB, patch)
2019-09-26 10:15 PDT, Patrick Griffis
no flags
Patch (2.14 KB, patch)
2020-03-30 15:53 PDT, Michael Catanzaro
pgriffis: review-
Patrick Griffis
Comment 1 2019-09-26 10:15:00 PDT
EWS Watchlist
Comment 2 2019-09-26 10:15:34 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Michael Catanzaro
Comment 3 2019-09-26 10:18:29 PDT
Comment on attachment 379656 [details] Patch Now that you are a committer, you should have a trac account and can add this to https://trac.webkit.org/wiki/WebKitGTK/2.26.x. Otherwise your change might not reach users until 2.28.
WebKit Commit Bot
Comment 4 2019-09-26 11:04:38 PDT
Comment on attachment 379656 [details] Patch Clearing flags on attachment: 379656 Committed r250388: <https://trac.webkit.org/changeset/250388>
WebKit Commit Bot
Comment 5 2019-09-26 11:04:40 PDT
All reviewed patches have been landed. Closing bug.
Michael Catanzaro
Comment 6 2020-03-30 15:50:03 PDT
Comment on attachment 379656 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379656&action=review > Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:569 > if (g_str_has_suffix(themeName.get(), "-dark")) Um, well ":dark" isn't handled here. Surely this is a mistake? Looks like a mistake to me. Nowadays we also have PageClientImpl::themeName that would need to be fixed as well.
Michael Catanzaro
Comment 7 2020-03-30 15:51:04 PDT
(Assuming this is a mistake....)
Michael Catanzaro
Comment 8 2020-03-30 15:53:51 PDT
Michael Catanzaro
Comment 9 2020-03-30 15:54:27 PDT
Comment on attachment 394977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394977&action=review > Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:574 > 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; Patrick, is this OK?
Carlos Garcia Campos
Comment 10 2020-03-31 01:39:55 PDT
(In reply to Michael Catanzaro from comment #9) > Comment on attachment 394977 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394977&action=review > > > Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:574 > > 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; > > Patrick, is this OK? I don't think it is. Just check GTK code instead of guessing: https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtksettings.c#L3255 ':' is only used to check the theme variant for the GTK_THEME env variable.
Patrick Griffis
Comment 11 2020-03-31 06:14:08 PDT
Comment on attachment 394977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394977&action=review >>> Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:574 >>> return true; >> >> Patrick, is this OK? > > I don't think it is. Just check GTK code instead of guessing: > > https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtksettings.c#L3255 > > ':' is only used to check the theme variant for the GTK_THEME env variable. As carlos said :dark is a variant and not part of the theme name.
Michael Catanzaro
Comment 12 2020-03-31 08:58:18 PDT
OK!
Note You need to log in before you can comment on or make changes to this bug.