After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 382646 - Text inside the combobox is drawn with text[XXX]
Text inside the combobox is drawn with text[XXX]
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
Small patch
: 419973 484566 499727 519924 (view as bug list)
Depends on:
Reported: 2006-12-05 16:48 UTC by Benjamin Berg
Modified: 2015-07-31 12:53 UTC
See Also:
GNOME target: ---
GNOME version: ---

patch implementing this (6.82 KB, patch)
2006-12-05 18:42 UTC, Benjamin Berg
none Details | Review
saner patch (9.31 KB, patch)
2006-12-20 21:57 UTC, Benjamin Berg
none Details | Review
Updated patch against trunk. (8.33 KB, patch)
2008-10-02 20:59 UTC, Benjamin Berg
none Details | Review

Description Benjamin Berg 2006-12-05 16:48:22 UTC
The text in the GtkComboBox and its dropdown menu is drawn by the GtkCellRendererText. GtkCellRendererText always sets use_text when calling gtk_paint_layout, so that the themes text[] colors are used instead of fg[].

GtkComboBox should somehow force that the foreground colors get used when text is drawn in the menu and on a button.
Comment 1 Benjamin Berg 2006-12-05 18:42:00 UTC
Created attachment 77747 [details] [review]
patch implementing this

This patch adds a GTK_CELL_RENDERER_USE_FG flag to GtkCellRendererState to hint GtkCellRendererText to not set use_text.
It also adds a property "use-fg" to GtkCellView to set the flag. This property is then set in the combobox where apprioriate.
Comment 2 Benjamin Berg 2006-12-20 21:57:39 UTC
Created attachment 78717 [details] [review]
saner patch

This patch includes a getter function for the property and should emit correct signals.
I also tried generation of documentation and fixed a few things. The autogenerated stuff in the sgml files is not included.
Comment 3 Thomas Wood 2006-12-22 14:13:36 UTC
Would be great to have this fixed, as it is a major pain when creating themes.
Comment 4 Thomas Wood 2007-03-20 21:10:09 UTC
*** Bug 419973 has been marked as a duplicate of this bug. ***
Comment 5 Murray Cumming 2007-05-04 20:50:11 UTC
Apparently it works, and its documented. Permission to apply?

It would be nice to have clearer information about how this helps theme creators?   For instance, what does it make possible, or easier?
Comment 6 Benjamin Berg 2007-05-13 16:11:22 UTC
This bug breaks the rule that the "text" color is always used together with "base", and "fg" always with "bg". This is a problem even when text[NORMAL] and fg[NORMAL] are the same, as the different states may be different. Of course it is much worst if they differ.

Themes can work around this by trying to keep the text and foreground colors in sync (Clearlooks does this to some extend currently). But one needs to be carefull not to change too much when doing that.
Comment 7 Benjamin Berg 2007-10-08 07:29:24 UTC
*** Bug 484566 has been marked as a duplicate of this bug. ***
Comment 8 Michael Hofmann 2007-11-27 15:46:39 UTC
*** Bug 499727 has been marked as a duplicate of this bug. ***
Comment 9 Benjamin Berg 2008-03-02 16:13:43 UTC
*** Bug 519924 has been marked as a duplicate of this bug. ***
Comment 10 Benjamin Berg 2008-10-02 20:59:33 UTC
Created attachment 119825 [details] [review]
Updated patch against trunk.
Comment 11 Cosimo Cecchi 2011-09-17 04:26:48 UTC
This looks obsolete now with GTK 3.
Comment 12 Benjamin Berg 2011-09-18 11:06:23 UTC
Hm, I think your are right, it should be working with GTK+ 3, as the style context is created for the correct widget.

It looks like it is possible to correctly match the style depending on the parent widgets.

Feel free to close the bug.
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2011-09-18 12:15:21 UTC
Is there a something the application developers can do on gtk+2 if it is not going to be fixed there?
Comment 14 Benjamin Berg 2011-09-18 12:55:49 UTC
You basically need the patch for GTK+ 2.x. There exist workarounds for themes at least for the combobox case.

If an application runs into this issue because it uses GtkCellView, then it is rather hard to do a work around.
Comment 15 Matthias Clasen 2015-07-31 12:53:55 UTC
I don't think this is going to get fixed in 2.x