Bug 1169233 - Get grey (inactive) text color from menu labels. r=karlt
authorMartin Stransky <stransky@redhat.com>
Fri, 29 May 2015 05:40:00 -0400
changeset 247155 5b47a32145406cda21bf67b849923aa5195138d2
parent 247154 92c770d9b2ccb29464add35f1b69119e9fe6b186
child 247156 3c2597bb3edbdc2ad854919388c49e78e49eb8ee
push id28855
push userkwierso@gmail.com
push dateFri, 05 Jun 2015 01:19:30 +0000
treeherdermozilla-central@227d356ac030 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1169233
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169233 - Get grey (inactive) text color from menu labels. r=karlt
widget/gtk/nsLookAndFeel.cpp
widget/gtk/nsLookAndFeel.h
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -238,19 +238,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI
         // 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);
+        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;
@@ -1024,16 +1022,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);
--- 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;