summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qgtkstyle.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@nokia.com>2010-10-01 10:08:24 (GMT)
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2010-10-01 10:23:38 (GMT)
commit4ee6f86baccd7c5ba065fd00d22120e71e1f6d3a (patch)
tree7baa70c414193f82eb1eb5f2d414b0b912526336 /src/gui/styles/qgtkstyle.cpp
parente4407012815a805d9a7d1a3beb7038a93cdd74dd (diff)
downloadQt-4ee6f86baccd7c5ba065fd00d22120e71e1f6d3a.zip
Qt-4ee6f86baccd7c5ba065fd00d22120e71e1f6d3a.tar.gz
Qt-4ee6f86baccd7c5ba065fd00d22120e71e1f6d3a.tar.bz2
Incorrect selection background for unfocused widgets with GTK
In Ubuntu 10.10 the unfocused selection background is different from the focused one. Interestingly they use GTK_STATE_ACTIVE for unfocused widgets. This was verified back to GTK 2.10 which is the required minimum for QGtkStyle so it should be safe for all other styles as well. Task-number: QTBUG-13792 Reviewed-by: thorbjorn
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r--src/gui/styles/qgtkstyle.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index c5429dd..7f342f9 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -225,9 +225,8 @@ QPalette QGtkStyle::standardPalette() const
GtkStyle *style = d->gtkStyle();
GtkWidget *gtkButton = d->gtkWidget("GtkButton");
GtkWidget *gtkEntry = d->getTextColorWidget();
-
- GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg;
- QColor bg, base, text, fg, highlight, highlightText;
+ GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
+ QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
gdkBg = style->bg[GTK_STATE_NORMAL];
gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
@@ -237,14 +236,23 @@ QPalette QGtkStyle::standardPalette() const
gdkText = gtkEntry->style->text[GTK_STATE_NORMAL];
gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED];
+
+ // The ACTIVE base color is really used for inactive windows
+ gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE];
+ gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE];
+
bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
fg = QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8);
base = QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8);
highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8);
highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8);
+ inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8);
+ inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8);
palette.setColor(QPalette::HighlightedText, highlightText);
+
+
palette.setColor(QPalette::Light, bg.lighter(125));
palette.setColor(QPalette::Shadow, bg.darker(130));
palette.setColor(QPalette::Dark, bg.darker(120));
@@ -279,6 +287,10 @@ QPalette QGtkStyle::standardPalette() const
highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha());
palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText);
+
+ palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt);
+ palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
+
style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
d->gtk_window_get_type());
if (style) {