Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1645)

Unified Diff: chrome/browser/gtk/gtk_theme_provider.cc

Issue 159143: GTK Themes: Get text color from a label object; this should fix some theme text problems. (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/gtk/gtk_theme_provider.cc
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index f18ff3f89fb26708bf9f19873b3b4111ff34a178..5f102e2f65a1b7dcce1c43ee3a98aba4a5892f9f 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -37,7 +37,8 @@ GtkThemeProvider* GtkThemeProvider::GetFrom(Profile* profile) {
GtkThemeProvider::GtkThemeProvider()
: BrowserThemeProvider(),
- fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)) {
+ fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)),
+ fake_label_(gtk_label_new("")) {
// Only realized widgets receive style-set notifications, which we need to
// broadcast new theme images and colors.
gtk_widget_realize(fake_window_);
@@ -47,6 +48,7 @@ GtkThemeProvider::GtkThemeProvider()
GtkThemeProvider::~GtkThemeProvider() {
profile()->GetPrefs()->RemovePrefObserver(prefs::kUsesSystemTheme, this);
gtk_widget_destroy(fake_window_);
+ gtk_widget_destroy(fake_label_);
// Disconnect from the destroy signal of any redisual widgets in
// |chrome_buttons_|.
@@ -165,44 +167,46 @@ void GtkThemeProvider::OnStyleSet(GtkWidget* widget,
}
void GtkThemeProvider::LoadGtkValues() {
- GtkStyle* style = gtk_rc_get_style(fake_window_);
+ GtkStyle* window_style = gtk_rc_get_style(fake_window_);
+ GtkStyle* label_style = gtk_rc_get_style(fake_label_);
- SetThemeColorFromGtk(kColorFrame, &style->bg[GTK_STATE_SELECTED]);
+ SetThemeColorFromGtk(kColorFrame, &window_style->bg[GTK_STATE_SELECTED]);
// Skip COLOR_FRAME_INACTIVE and the incognito colors, as they will be
// autogenerated from tints.
SetThemeColorFromGtk(kColorToolbar,
- &style->bg[GTK_STATE_NORMAL]);
+ &window_style->bg[GTK_STATE_NORMAL]);
SetThemeColorFromGtk(kColorTabText,
- &style->text[GTK_STATE_NORMAL]);
+ &label_style->text[GTK_STATE_NORMAL]);
SetThemeColorFromGtk(kColorBackgroundTabText,
Evan Stade 2009/07/21 19:12:19 shouldn't TabText and BackgroundTabText be differe
Elliot Glaysher 2009/07/21 19:21:36 They should, but that's a larger change then this.
- &style->text[GTK_STATE_NORMAL]);
+ &label_style->text[GTK_STATE_NORMAL]);
SetThemeColorFromGtk(kColorBookmarkText,
- &style->text[GTK_STATE_NORMAL]);
+ &label_style->text[GTK_STATE_NORMAL]);
SetThemeColorFromGtk(kColorControlBackground,
- &style->bg[GTK_STATE_NORMAL]);
+ &window_style->bg[GTK_STATE_NORMAL]);
SetThemeColorFromGtk(kColorButtonBackground,
- &style->bg[GTK_STATE_NORMAL]);
+ &window_style->bg[GTK_STATE_NORMAL]);
- SetThemeTintFromGtk(kTintButtons, &style->bg[GTK_STATE_SELECTED],
+ SetThemeTintFromGtk(kTintButtons, &window_style->bg[GTK_STATE_SELECTED],
kDefaultTintButtons);
- SetThemeTintFromGtk(kTintFrame, &style->bg[GTK_STATE_SELECTED],
+ SetThemeTintFromGtk(kTintFrame, &window_style->bg[GTK_STATE_SELECTED],
kDefaultTintFrame);
SetThemeTintFromGtk(kTintFrameIncognito,
- &style->bg[GTK_STATE_SELECTED],
+ &window_style->bg[GTK_STATE_SELECTED],
kDefaultTintFrameIncognito);
SetThemeTintFromGtk(kTintBackgroundTab,
- &style->bg[GTK_STATE_SELECTED],
+ &window_style->bg[GTK_STATE_SELECTED],
kDefaultTintBackgroundTab);
// The inactive color/tint is special: We *must* use the exact insensitive
// color for all inactive windows, otherwise we end up neon pink half the
// time.
- SetThemeColorFromGtk(kColorFrameInactive, &style->bg[GTK_STATE_INSENSITIVE]);
+ SetThemeColorFromGtk(kColorFrameInactive,
+ &window_style->bg[GTK_STATE_INSENSITIVE]);
SetThemeTintFromGtk(kTintFrameInactive,
- &style->bg[GTK_STATE_INSENSITIVE],
+ &window_style->bg[GTK_STATE_INSENSITIVE],
kExactColor);
SetThemeTintFromGtk(kTintFrameIncognitoInactive,
- &style->bg[GTK_STATE_INSENSITIVE],
+ &window_style->bg[GTK_STATE_INSENSITIVE],
kExactColor);
GenerateFrameColors();
« chrome/browser/gtk/gtk_theme_provider.h ('K') | « chrome/browser/gtk/gtk_theme_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698