GNOME Bugzilla – Bug 128560
Menu Items show incorrect foreground color in some themes.
Last modified: 2004-12-22 21:47:04 UTC
This was compiled and tested under gtkmm-2.2.8 with the Industrial and Bluecurve-Gnome GTK2 Themes. relevant software: Fedora Core 1, Gnome 2.4, gtk 2.2.4 Under certain themes, when a menu item is selected (i.e, mouse over) the foreground color of the menu item does not change correctly to the theme's foreground color. comparison: Gtk+-2.0 http://warlock.arcaner.com/gtk-demo-menu.png Gtk-- http://warlock.arcaner.com/gtkmm-demo-menu.png
Where exactly did you get the themes? Is there a source tarball somewhere? Sorry, I'm not on Fedora yet, just RedHat 9. I have tried this with standard GNOME high-contrast themes, but can't reproduce it. Are your GTK+ and gtkmm definitely in the same prefix?
The Gnome-Bluecurve theme came with Fedora Core, and the Industrial GTK theme is a compiled theme downloaded from http://art.gnome.org. The Industrial theme is installed under my local users home directory. The prefix for gtk+-2.2.4 is /usr and the prefix for gtkmm-2.2.8 is /usr/local.. will that make a difference?
OK, I'm at this point now: I can reproduce the bug. I see what you mean and I'm getting to it. I tried different combinations of Gtk and Gtkmm classes. And now I'm diving into gtk code to look where the actual drawing is done and which parameters are from where.
I tracked it down ... after all not so difficult but hey, who could know that. Bluecurve takes advantage of 2 feature of gtkrc. 1) you can define many different sub-styles of a default style. They inherent it's properties and you can override some of them to change the look. -- Bluecurve overrides the default style in the menu-item style and resets the color for prelighted (mouse-over) text. 2) you can apply those specialized style classes to certain widget_classes by name. -- Bluecurve sets this to the menu-item style for the `class` "GtkMenuItem" and the `widget_class` "*.GtkMenuItem.*". I don't know the difference between those two, but I hope to get to it. (there must be some doc on the net) Now the thing is that gtkmm creates new subclasses of the Gtk+ ones and changes the name to gtkmm__GtkClassName. Now gtk does not know that the menu-item style should be applied to gtkmm__GtkMenuItem. You can fix this by yourself if you add a line to the Bluecurve gtkrc file, like: widget_class "*.gtkmm__GtkMenuItem.*" style "bluecurve-menu-item" this way it works, but this is very unpleasant to change everything. I'll look further to find out wether there exists a better solution.
I have to admit that this is somewhat strange: the `class` directive should sort this out. `class` is used in a hierarchical way. So any widget that is of a class that is derieved from GtkMenuItem SHOULD get this style too, but somehow it doesn't.
Hagen, exactly what line of what source code file should I look at to see this?
No source code. This is intended to be common behavior for gtk+. The documentation is at http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html under paragraph "Pathnames and patterns". I'll paste an extract: Matching against class is a little different. The pattern match is done against all class names in the widgets class hierarchy (not the layout hierarchy) in sequence, so the pattern: class "GtkButton" style "my-style" will match not just GtkButton widgets, but also GtkToggleButton and GtkCheckButton widgets, since those classes derive from GtkButton. This means that gtkmm__GtkMenuItem s should be matched for class "GtkMenuItem" style "my-style" too. I somehow get the feeling that this is an error within Gtk+ but then again it works for the GtkImageMenuItem class which is derieved from GtkMenuItem. I really don't know how to track this bug down any further: I wrote sample applications to layout the class hirarchy and there it seems perfectly normal to me. I wrote sample apps to check for style setting to the accellabel and the menuitem and it seems all very well there to. But I don't completely understand the styles in Gtk+ so I can't proof it that way ...
*** This bug has been marked as a duplicate of 142417 ***