Bug 972382 - [GTK3] Theme is not loaded in other WM's (MATE, XFCE and so). r=karlt
authorMartin Stransky <stransky@redhat.com>
Mon, 24 Feb 2014 10:09:55 -0500
changeset 170547 b3b8d728624319ccb3d51f3ad3a3e6caaaa37cbe
parent 170546 195910dc76049b34fb42fbd196df73a64955a31f
child 170548 5fa7f5df67b342839cef5a928dd43d1eec9a1902
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerskarlt
bugs972382
milestone30.0a1
Bug 972382 - [GTK3] Theme is not loaded in other WM's (MATE, XFCE and so). r=karlt
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -941,16 +941,21 @@ nsLookAndFeel::Init()
         sMenuHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_PRELIGHT]);
     }
 
     g_object_unref(menu);
 #else
     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
+    (void)gtk_settings_get_for_screen(gdk_screen_get_default());
+
     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);
 
     mViewStyle = create_context(path);
     gtk_style_context_add_class(mViewStyle, GTK_STYLE_CLASS_VIEW);