bug 1343802 update notebook_has_tab_gap and scrollbar metrics after theme changes r?jhorak
MozReview-Commit-ID: IRPXNwLe5Ey
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -80,30 +80,39 @@ gint
moz_gtk_init()
{
if (gtk_major_version > 3 ||
(gtk_major_version == 3 && gtk_minor_version >= 14))
checkbox_check_state = GTK_STATE_FLAG_CHECKED;
else
checkbox_check_state = GTK_STATE_FLAG_ACTIVE;
+ moz_gtk_refresh();
+
+ return MOZ_GTK_SUCCESS;
+}
+
+void
+moz_gtk_refresh()
+{
if (gtk_check_version(3, 12, 0) == nullptr &&
gtk_check_version(3, 20, 0) != nullptr)
{
// Deprecated for Gtk >= 3.20+
GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_TAB_TOP);
gtk_style_context_get_style(style,
"has-tab-gap", ¬ebook_has_tab_gap, NULL);
ReleaseStyleContext(style);
}
else {
notebook_has_tab_gap = true;
}
- return MOZ_GTK_SUCCESS;
+ sScrollbarMetrics[GTK_ORIENTATION_HORIZONTAL].initialized = false;
+ sScrollbarMetrics[GTK_ORIENTATION_VERTICAL].initialized = false;
}
gint
moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing)
{
gtk_widget_style_get(GetWidget(MOZ_GTK_CHECKBUTTON_CONTAINER),
"indicator_size", indicator_size,
"indicator_spacing", indicator_spacing,
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -284,16 +284,21 @@ typedef enum {
* prior to using any other functionality.
* returns: MOZ_GTK_SUCCESS if there were no errors
* MOZ_GTK_UNSAFE_THEME if the current theme engine is known
* to crash with gtkdrawing.
*/
gint moz_gtk_init();
/**
+ * Updates the drawing library when the theme changes.
+ */
+void moz_gtk_refresh();
+
+/**
* Perform cleanup of the drawing library. You should call this function
* when your program exits, or you no longer need the library.
*
* returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
*/
gint moz_gtk_shutdown();
#if (MOZ_WIDGET_GTK == 2)
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -1440,16 +1440,17 @@ nsLookAndFeel::GetPasswordCharacterImpl(
{
return sInvisibleCharacter;
}
void
nsLookAndFeel::RefreshImpl()
{
nsXPLookAndFeel::RefreshImpl();
+ moz_gtk_refresh();
mDefaultFontCached = false;
mButtonFontCached = false;
mFieldFontCached = false;
mMenuFontCached = false;
#if (MOZ_WIDGET_GTK == 2)
g_object_unref(mStyle);