Enable dark themes by pref in about:config (Bug 1272332)
This commit is contained in:
parent
eb56d8c28e
commit
3665223cf1
@ -82,7 +82,7 @@
|
||||
Summary: Mozilla Firefox Web browser
|
||||
Name: firefox
|
||||
Version: 48.0
|
||||
Release: 3%{?pre_tag}%{?dist}
|
||||
Release: 4%{?pre_tag}%{?dist}
|
||||
URL: https://www.mozilla.org/firefox/
|
||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||
Group: Applications/Internet
|
||||
@ -129,6 +129,7 @@ Patch404: mozilla-1270046.patch
|
||||
Patch405: mozilla-1245783.patch
|
||||
Patch406: mozilla-256180.patch
|
||||
Patch407: mozilla-890908-async-nego.patch
|
||||
Patch408: mozilla-1272332.patch
|
||||
|
||||
# Debian patches
|
||||
Patch500: mozilla-440908.patch
|
||||
@ -273,6 +274,7 @@ cd %{tarballdir}
|
||||
%patch405 -p1 -b .1245783
|
||||
%patch406 -p1 -b .256180
|
||||
%patch407 -p1 -b .890908-async-nego
|
||||
%patch408 -p1 -b .1272332
|
||||
|
||||
# Debian extension patch
|
||||
%patch500 -p1 -b .440908
|
||||
@ -772,6 +774,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
%changelog
|
||||
* Thu Jul 28 2016 Martin Stransky <stransky@redhat.com> - 48.0-4
|
||||
- Enable dark themes by pref in about:config (Bug 1272332)
|
||||
|
||||
* Wed Jul 27 2016 Martin Stransky <stransky@redhat.com> - 48.0-3
|
||||
- Updated to 48.0 (B2)
|
||||
|
||||
|
71
mozilla-1272332.patch
Normal file
71
mozilla-1272332.patch
Normal file
@ -0,0 +1,71 @@
|
||||
# HG changeset patch
|
||||
# User Nicolas Silva <nsilva@mozilla.com>
|
||||
# Parent 14c5bf11d37b9e92d27f7089d9392de2ac339bb3
|
||||
Bug 1272332 - Allow gtk the global dark theme behind a pref. r=karlt
|
||||
|
||||
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
|
||||
--- a/modules/libpref/init/all.js
|
||||
+++ b/modules/libpref/init/all.js
|
||||
@@ -4560,16 +4560,17 @@ pref("gfx.content.use-native-pushlayer",
|
||||
#ifdef ANDROID
|
||||
pref("gfx.apitrace.enabled",false);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
pref("gfx.content.use-native-pushlayer", true);
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
pref("gfx.xrender.enabled",false);
|
||||
+pref("widget.allow-gtk-dark-theme", false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("gfx.content.use-native-pushlayer", true);
|
||||
|
||||
// Whether to disable the automatic detection and use of direct2d.
|
||||
pref("gfx.direct2d.disabled", false);
|
||||
diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
|
||||
--- a/widget/gtk/nsLookAndFeel.cpp
|
||||
+++ b/widget/gtk/nsLookAndFeel.cpp
|
||||
@@ -1093,26 +1093,32 @@ nsLookAndFeel::Init()
|
||||
GdkRGBA color;
|
||||
GtkStyleContext *style;
|
||||
|
||||
// Gtk manages a screen's CSS in the settings object so we
|
||||
// ask Gtk to create it explicitly. Otherwise we may end up
|
||||
// with wrong color theme, see Bug 972382
|
||||
GtkSettings *settings = gtk_settings_get_for_screen(gdk_screen_get_default());
|
||||
|
||||
- // Disable dark theme because it interacts poorly with widget styling in
|
||||
- // web content (see bug 1216658).
|
||||
- // To avoid triggering reload of theme settings unnecessarily, only set the
|
||||
- // setting when necessary.
|
||||
- const gchar* dark_setting = "gtk-application-prefer-dark-theme";
|
||||
- gboolean dark;
|
||||
- g_object_get(settings, dark_setting, &dark, nullptr);
|
||||
|
||||
- if (dark) {
|
||||
- g_object_set(settings, dark_setting, FALSE, nullptr);
|
||||
+ bool isContentProcess = XRE_IsContentProcess();
|
||||
+ bool allowDarkTheme = mozilla::Preferences::GetBool("widget.allow-gtk-dark-theme", false);
|
||||
+
|
||||
+ if (isContentProcess || !allowDarkTheme) {
|
||||
+ // Disable dark theme because it interacts poorly with widget styling in
|
||||
+ // web content (see bug 1216658).
|
||||
+ // To avoid triggering reload of theme settings unnecessarily, only set the
|
||||
+ // setting when necessary.
|
||||
+ const gchar* dark_setting = "gtk-application-prefer-dark-theme";
|
||||
+ gboolean dark;
|
||||
+ g_object_get(settings, dark_setting, &dark, nullptr);
|
||||
+
|
||||
+ if (dark) {
|
||||
+ g_object_set(settings, dark_setting, FALSE, nullptr);
|
||||
+ }
|
||||
}
|
||||
|
||||
GtkWidgetPath *path = gtk_widget_path_new();
|
||||
gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
|
||||
|
||||
mBackgroundStyle = create_context(path);
|
||||
gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND);
|
||||
|
Loading…
Reference in New Issue
Block a user