Blob Blame History Raw
# HG changeset patch
# User Martin Stransky <stransky@redhat.com>
# Parent  f986e55c4e0b41c6b50bd74d287614b564d7895f
Bug 1169233 - Get grey (inactive) text color from menu labels, r=?karlt

diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -237,20 +237,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
     case eColorID_inactiveborder:
         // inactive window border
         gtk_style_context_get_border_color(mBackgroundStyle, 
                                            GTK_STATE_FLAG_INSENSITIVE, 
                                            &gdk_color);
         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
         break;
     case eColorID_graytext: // disabled text in windows, menus, etc.
-    case eColorID_inactivecaptiontext: // text in inactive window caption
-        gtk_style_context_get_color(mBackgroundStyle, 
-                                    GTK_STATE_FLAG_INSENSITIVE, &gdk_color);
-        aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+    case eColorID_inactivecaptiontext: // text in inactive window caption
+        aColor = sMenuTextInactive;
         break;
     case eColorID_inactivecaption:
         // inactive window caption
         gtk_style_context_get_background_color(mBackgroundStyle, 
                                                GTK_STATE_FLAG_INSENSITIVE, 
                                                &gdk_color);
         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
         break;
@@ -1023,16 +1021,18 @@ nsLookAndFeel::Init()
     g_object_ref_sink(menu);
 
     gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 
     style = gtk_widget_get_style_context(accel_label);
     gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sMenuText = GDK_RGBA_TO_NS_RGBA(color);
+    gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
+    sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
 
     style = gtk_widget_get_style_context(menu);
     gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
 
     style = gtk_widget_get_style_context(menuitem);
     gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
     sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h
--- a/widget/gtk/nsLookAndFeel.h
+++ b/widget/gtk/nsLookAndFeel.h
@@ -54,16 +54,17 @@ protected:
 
     // Cached colors
     nscolor sInfoBackground;
     nscolor sInfoText;
     nscolor sMenuBackground;
     nscolor sMenuBarText;
     nscolor sMenuBarHoverText;
     nscolor sMenuText;
+    nscolor sMenuTextInactive;
     nscolor sMenuHover;
     nscolor sMenuHoverText;
     nscolor sButtonText;
     nscolor sButtonHoverText;
     nscolor sButtonBackground;
     nscolor sFrameOuterLightBorder;
     nscolor sFrameInnerDarkBorder;
     nscolor sOddCellBackground;