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 671437 - GtkStyle background color regression
GtkStyle background color regression
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 674407 675051 676115 676952 679117 679595 682631 707624 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-03-06 04:10 UTC by Jean-François Fortin Tam
Modified: 2014-04-28 20:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (83.05 KB, image/png)
2012-03-06 04:10 UTC, Jean-François Fortin Tam
  Details
Screenshot without Adwaita (186.04 KB, image/png)
2012-03-06 12:05 UTC, Matthew Barnes
  Details
Handle transparent colors better in GtkStyle emulation (1.15 KB, patch)
2012-06-28 19:34 UTC, Alexander Larsson
committed Details | Review

Description Jean-François Fortin Tam 2012-03-06 04:10:19 UTC
Created attachment 209045 [details]
screenshot

In Evo 3.3.90, it seems that
- the listview widgets containing the list of messages or the list of tasks or memos (on the right; not the treeview on the left)
- the message view's background

... now show with a greyish color, as the screenshot illustrates. It used to be white/theme-dependent in 3.2 and earlier, and Evo is the only application I can see with this symptom in GNOME 3.3.x.
Comment 1 Matthew Barnes 2012-03-06 12:05:37 UTC
Created attachment 209076 [details]
Screenshot without Adwaita

Confirming.  It's even worse when not using Adwaita.

This is a GtkStyle regression introduced between GTK+ 3.2 and 3.3.  Reassigning.
Comment 2 Matthias Clasen 2012-03-09 04:41:09 UTC
I'm not seeing this with 3.3.90/91 in F17.
I assume this has been fixed in gtk and/or adwaita.
Can you confirm ?
Comment 3 Matthew Barnes 2012-03-09 08:05:10 UTC
I'm still seeing what I posted in comment #1 having just rebuilt against an up-to-date gtk+ git repo and running with no theme set, so not an Adwaita issue.

Had been running GTK+ 3.2 until just recently.  The black backgrounds started after I upgraded to 3.3.

I'll try and bisect it over the weekend.
Comment 4 André Klapper 2012-03-09 10:28:06 UTC
(In reply to comment #1)
> Created an attachment (id=209076) [details]
> Screenshot without Adwaita
> Confirming.  It's even worse when not using Adwaita.

I can confirm this - I have seen this for at least 21 days now but I thought it's something broken on my machine with the theming.
Comment 5 Benjamin Otte (Company) 2012-03-09 15:07:12 UTC
Hrm, maybe it's an issue with the X driver?

Could you try running with the env var GDK_RENDERING=image set?
Comment 6 Matthew Barnes 2012-03-09 15:18:10 UTC
This might be an Evolution bug after all since bisecting GTK+ since 3.2 didn't yield anything.

Stand by...
Comment 7 Jean-François Fortin Tam 2012-03-09 15:38:13 UTC
Doubt it's an X driver issue, given that I was running this in virtualbox and the devs are probably running Intel or Radeon chips on thinkpads :)
Comment 8 Matthew Barnes 2012-03-09 17:50:40 UTC
Cleaned out my development environment, updated and rebuilt GLib, GTK+, GDK-Pixbuf, GtkHTML, E-D-S and Evolution from git and the backgrounds are back to normal for me now.

Must have been whatever combination of module revisions I had before updating... unfortunately I failed to note them.  If anyone is still seeing this, it would be helpful to note the versions or even git revisions of the aforementioned modules.

In any case, I suggest removing this from the blocker list.
Comment 9 Matthias Clasen 2012-03-09 19:37:54 UTC
Thanks for retesting !
Comment 10 Jean-François Fortin Tam 2012-03-19 01:31:01 UTC
Tested again after applying F17 updates, the issue is gone now.
Comment 11 Paul Menzel 2012-04-24 13:25:35 UTC
(In reply to comment #8)
> Cleaned out my development environment, updated and rebuilt GLib, GTK+,
> GDK-Pixbuf, GtkHTML, E-D-S and Evolution from git and the backgrounds are back
> to normal for me now.
> 
> Must have been whatever combination of module revisions I had before
> updating... unfortunately I failed to note them.  If anyone is still seeing
> this, it would be helpful to note the versions or even git revisions of the
> aforementioned modules.
> 
> In any case, I suggest removing this from the blocker list.

I am experiencing the same thing with Evolution 3.2.2-1 in Debian Sid/unstable after upgrading the following non-evolution packages [1][2].

        [AKTUALISIERUNG] apt:i386 0.8.15.10 -> 0.9.2
        [AKTUALISIERUNG] apt-utils:i386 0.9.1 -> 0.9.2
        [AKTUALISIERUNG] baobab:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] cdbs:i386 0.4.110 -> 0.4.111
        [AKTUALISIERUNG] cmake:i386 2.8.7-4 -> 2.8.8-1
        [AKTUALISIERUNG] cmake-data:i386 2.8.7-4 -> 2.8.8-1
        [AKTUALISIERUNG] cups-filters:i386 1.0.13-1 -> 1.0.16-2
        [AKTUALISIERUNG] eog:i386 3.2.2-3 -> 3.4.1-2
        [AKTUALISIERUNG] eog-dbg:i386 3.2.2-3 -> 3.4.1-2
        [AKTUALISIERUNG] gir1.2-freedesktop:i386 1.32.0-1 -> 1.32.1-1
        [AKTUALISIERUNG] gir1.2-glib-2.0:i386 1.32.0-1 -> 1.32.1-1
        [AKTUALISIERUNG] gir1.2-gnomekeyring-1.0:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] gir1.2-gtk-3.0:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] gir1.2-gtksource-3.0:i386 3.4.0-2 -> 3.4.1-1
        [AKTUALISIERUNG] gir1.2-telepathyglib-0.12:i386 0.16.2-1+b1 -> 0.18.1-1
        [AKTUALISIERUNG] gnome-desktop3-data:i386 3.2.1-4 -> 3.4.1-2
        [AKTUALISIERUNG] gnome-power-manager:i386 3.2.1-2 -> 3.4.0-2
        [AKTUALISIERUNG] gnome-system-log:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] gnome-system-monitor:i386 3.2.1-1 -> 3.4.1-2
        [AKTUALISIERUNG] gnome-themes-standard:i386 3.2.1-2 -> 3.4.1-2
        [AKTUALISIERUNG] gobject-introspection:i386 1.32.0-1 -> 1.32.1-1
        [AKTUALISIERUNG] help2man:i386 1.40.8 -> 1.40.9
        [AKTUALISIERUNG] keyboard-configuration:i386 1.75 -> 1.76
        [AKTUALISIERUNG] libapt-inst1.5:i386 0.9.1 -> 0.9.2
        [AKTUALISIERUNG] libapt-pkg4.12:i386 0.9.1 -> 0.9.2
        [AKTUALISIERUNG] libaudio-dev:i386 1.9.3-4 -> 1.9.3-5
        [AKTUALISIERUNG] libaudio2:i386 1.9.3-4 -> 1.9.3-5
        [AKTUALISIERUNG] libcupsfilters1:i386 1.0.13-1 -> 1.0.16-2
        [AKTUALISIERUNG] libdmapsharing-3.0-2:i386 2.9.14-1 -> 2.9.15-1
        [AKTUALISIERUNG] libgail-3-0:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgail-3-0-dbg:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgirepository-1.0-1:i386 1.32.0-1 -> 1.32.1-1
        [AKTUALISIERUNG] libgirepository1.0-dev:i386 1.32.0-1 -> 1.32.1-1
        [AKTUALISIERUNG] libgladeui-2-0:i386 3.11.0-1 -> 3.12.0-1
        [AKTUALISIERUNG] libgladeui-common:i386 3.11.0-1 -> 3.12.0-1
        [AKTUALISIERUNG] libgnome-desktop-3-2:i386 3.2.1-4 -> 3.4.1-2
        [AKTUALISIERUNG] libgnome-keyring-common:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] libgnome-keyring-dev:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] libgnome-keyring0:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] libgnome-keyring0-dbg:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] libgtk-3-0:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgtk-3-0-dbg:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgtk-3-bin:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgtk-3-common:i386 3.2.3-1 -> 3.4.1-2
        [AKTUALISIERUNG] libgtkmm-3.0-1:i386 3.2.0-1 -> 3.4.0-2
        [AKTUALISIERUNG] libgtkmm-3.0-dbg:i386 3.2.0-1 -> 3.4.0-2
        [AKTUALISIERUNG] libgtksourceview-3.0-0:i386 3.4.0-2 -> 3.4.1-1
        [AKTUALISIERUNG] libgtksourceview-3.0-common:i386 3.4.0-2 -> 3.4.1-1
        [AKTUALISIERUNG] libhyphen0:i386 2.8.3-1 -> 2.8.3-2
        [AKTUALISIERUNG] libmtp-common:i386 1.1.3-1 -> 1.1.3-2
        [AKTUALISIERUNG] libmtp-dbg:i386 1.1.3-1 -> 1.1.3-2
        [AKTUALISIERUNG] libmtp-runtime:i386 1.1.3-1 -> 1.1.3-2
        [AKTUALISIERUNG] libmtp9:i386 1.1.3-1 -> 1.1.3-2
        [AKTUALISIERUNG] libnautilus-extension1a:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] libssl-dev:i386 1.0.1-4 -> 1.0.1a-3
        [AKTUALISIERUNG] libssl1.0.0:i386 1.0.1-4 -> 1.0.1a-3
        [AKTUALISIERUNG] libtelepathy-glib0:i386 0.16.2-1+b1 -> 0.18.1-1
        [AKTUALISIERUNG] libx11-6:i386 2:1.4.4-4 -> 2:1.4.99.901-1
        [AKTUALISIERUNG] libx11-6-dbg:i386 2:1.4.4-4 -> 2:1.4.99.901-1
        [AKTUALISIERUNG] libx11-data:i386 2:1.4.4-4 -> 2:1.4.99.901-1
        [AKTUALISIERUNG] libx11-dev:i386 2:1.4.4-4 -> 2:1.4.99.901-1
        [AKTUALISIERUNG] libx11-xcb1:i386 2:1.4.4-4 -> 2:1.4.99.901-1
        [AKTUALISIERUNG] libxi-dev:i386 2:1.4.5-1.1 -> 2:1.6.0-1
        [AKTUALISIERUNG] libxi6:i386 2:1.4.5-1.1 -> 2:1.6.0-1
        [AKTUALISIERUNG] libxinerama-dev:i386 2:1.1.1-3 -> 2:1.1.2-1
        [AKTUALISIERUNG] libxinerama1:i386 2:1.1.1-3 -> 2:1.1.2-1
        [AKTUALISIERUNG] lsb-base:i386 4.1+Debian0 -> 4.1+Debian1
        [AKTUALISIERUNG] lsb-release:i386 4.1+Debian0 -> 4.1+Debian1
        [AKTUALISIERUNG] lxmenu-data:i386 0.1.2-1 -> 0.1.2-2
        [AKTUALISIERUNG] mtp-tools:i386 1.1.3-1 -> 1.1.3-2
        [AKTUALISIERUNG] nautilus:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] nautilus-data:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] nautilus-dbg:i386 3.2.1-3 -> 3.4.1-1
        [AKTUALISIERUNG] openssl:i386 1.0.1-4 -> 1.0.1a-3
        [AKTUALISIERUNG] os-prober:i386 1.51 -> 1.52
        [AKTUALISIERUNG] simple-scan:i386 3.4.0-1 -> 3.4.1-1
        [AKTUALISIERUNG] unattended-upgrades:i386 0.76 -> 0.76.2

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669694
[2] http://mail.gnome.org/archives/evolution-list/2012-April/msg00058.html
Comment 12 Matthew Barnes 2012-04-29 11:27:39 UTC
*** Bug 675051 has been marked as a duplicate of this bug. ***
Comment 13 Stefan Förster 2012-04-29 16:27:07 UTC
I found a workaround (under Arch Linux): downgrade the package "gtk3" from 3.4.1 to 3.2.3. Then the "black on black" colour problem in Evolution 3.4.1 is gone.

Obviously this bug still persists in the current GTK version. I wonder why this bug is marked as "resolved"?
Comment 14 Paul Menzel 2012-05-10 08:26:57 UTC
Could this report please be reopened? It is at least not INVALID and enough information is provided to figure out the culprit.
Comment 15 Matthew Barnes 2012-05-10 12:51:57 UTC
Reopening as requested.

We got another question about it just today on the mailing list:
http://mail.gnome.org/archives/evolution-list/2012-May/msg00065.html
Comment 16 Paul Menzel 2012-05-11 09:31:30 UTC
Just as a follow up. Upgrading to GTK+ 3.4.1 does *not* fix this issue.

[AKTUALISIERUNG] gir1.2-gtk-3.0:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgail-3-0:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgail-3-0-dbg:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgtk-3-0:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgtk-3-0-dbg:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgtk-3-bin:i386 3.4.1-2 -> 3.4.2-1
[AKTUALISIERUNG] libgtk-3-common:i386 3.4.1-2 -> 3.4.2-1
Comment 17 Matthew Barnes 2012-05-15 17:46:02 UTC
*** Bug 676115 has been marked as a duplicate of this bug. ***
Comment 18 Rick Stanley 2012-05-15 18:54:36 UTC
Mathew, you marked my bug report 676115 as "RESOLVED", however, I don't see this as resolved, as the problem still exists in Evolution, v. 3.2.2 in Debian Testing.  Please advise how to correct this problem.
Comment 19 Matthew Barnes 2012-05-15 19:26:23 UTC
(In reply to comment #18)
> Mathew, you marked my bug report 676115 as "RESOLVED", however, I don't see
> this as resolved, as the problem still exists in Evolution, v. 3.2.2 in Debian
> Testing.  Please advise how to correct this problem.

Resolved does not imply fixed.  Your bug report was resolved as a duplicate of this bug report.
Comment 20 Matthias Clasen 2012-05-26 03:18:46 UTC
*** Bug 674407 has been marked as a duplicate of this bug. ***
Comment 21 Matthew Barnes 2012-05-27 05:07:51 UTC
I think I botched my first attempt at bisecting this so here's another try.  We're still getting questions about this issue on Evolution's mailing list.

I can still reproduce it by using the fallback GTK+ theme ("Raleigh" is it?).

Running the same Evolution revision against various GTK+ builds:

   master/HEAD   - Broken, GtkStyle backgrounds are black.

  gtk-3-4/HEAD   - Broken, GtkStyle backgrounds are black.

  gtk-3-4/3.4.0  - Broken, GtkStyle backgrounds are black.

  ... all subsequent 3.3.x releases presumed broken ...

  gtk-3-4/3.3.14 - Broken, GtkStyle backgrounds are black.

  gtk-3-4/3.3.12 - Works, GtkStyle backgrounds are normal.

  gtk-3-4/3.3.10 - Unusable, conflicting GIO dependencies.

  gtk-3-4/3.3.8  - Unusable, conflicting GIO dependencies.

  gtk-3-4/3.3.6  - Works, GtkStyle backgrounds are normal.

  gtk-3-4/3.3.4  - Works, GtkStyle backgrounds are normal.

  gtk-3-4/3.3.2  - Works, GtkStyle backgrounds are normal.

  gtk-3-2/HEAD   - Works, GtkStyle backgrounds are normal.

So the regression was introduced between 3.3.12 and 3.3.14.

Bisecting that range reveals the guilty commit to be:

http://git.gnome.org/browse/gtk+/commit/?id=4dd9a73c8ae5254361e746a3013e952e0f72d6a3

Which causes the screen capture shown in attachment #209076 [details].
Comment 22 André Klapper 2012-05-28 09:42:04 UTC
Bug 676952 might be another symptom.
Comment 23 André Klapper 2012-05-28 09:44:57 UTC
*** Bug 676952 has been marked as a duplicate of this bug. ***
Comment 24 August Karlstrom 2012-05-28 11:21:27 UTC
As I reported in Bug 676952 these black backgrounds show up in e.g. Gedit and Disk Utility as well when using the default ("no theme") Raleigh theme. To me it seems more likely that these applications are using GTK 3.4 incorrectly than there being a bug in the hard coded Raleigh theme.
Comment 25 Alexander Larsson 2012-06-28 19:28:56 UTC
Here is the problem for the evolution sidebar:

e_shell_sidebar_init () {
...
   widget = gtk_event_box_new ();
   style = gtk_widget_get_style (widget);
   color = &style->bg[GTK_STATE_ACTIVE];
   gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);

The problem with this is in the new world, the background color for a widget state might be (partially) transparent, but style->bg is a GdkColor which does not have any alpha values. The computation of the style colors happens in gtkstyle.c:set_color(), and atm it just throws away the alpha.

In this particular case the background is completely transparent (which is quite common in the new world where most widgets should draw their background, but the default is transparent). If you throw away the alpha you then get black, which is generally a bad background as most text is black.

I tried to make it detect transparent colors and look at the parent style context background, but that fails in this case as the widget is not yet in a hierarchy, and as such doesn't have a parent yet. And anyway, while that could work in some cases it would never handle other cases well like partially transparent backgrounds or cases where the parent style changes over time.

So, the simplest fix i could find was to just use the default value for completely transparent colors. This avoids complete failure like black-on-black, while being easy to understand.
Comment 26 Alexander Larsson 2012-06-28 19:34:54 UTC
Created attachment 217562 [details] [review]
Handle transparent colors better in GtkStyle emulation

We can't expose colors with alpha in the GtkStyle colors, since
GdkColor has no alpha. Currently we throw away alpha completely,
which fails very badly for completely transparent backgrounds,
which now is the default for most widgets, as it typically
end up with black-on-black.

We handle this by falling back on the default/previous colors for
transparent colors. This is is simple and avoids complete failure.
Comment 27 Alexander Larsson 2012-06-28 19:48:51 UTC
Attachment 217562 [details] pushed as 1042372 - Handle transparent colors better in GtkStyle emulation
Comment 28 André Klapper 2012-06-29 09:46:48 UTC
Is this safe to also commit to the 3.4 branch?
Comment 29 Matthew Barnes 2012-06-29 11:09:07 UTC
*** Bug 679117 has been marked as a duplicate of this bug. ***
Comment 30 Matthew Barnes 2012-06-30 17:39:01 UTC
Cherry-picked to gtk-3-4 with Benjamin's permission:

http://git.gnome.org/browse/gtk+/commit/?h=gtk-3-4&id=72feb95edb6ab8c3fac27c0c32afeb2b2f61bd1c
Comment 31 Matthew Barnes 2012-07-09 04:26:22 UTC
*** Bug 679595 has been marked as a duplicate of this bug. ***
Comment 32 Stefan Förster 2012-08-02 19:53:42 UTC
The "black on black" bug in evolution on my three Arch Linux installations is gone since the upgrade to gtk3 version 3.4.4. Many thanks for the bug fix.

The only remaining colour problem is that selecting text within an e-mail with the mouse results in a black stripe or rectangle, i.e. the selected text is rendered "black on black".
Comment 33 Matthew Barnes 2012-08-21 04:07:05 UTC
*** Bug 682321 has been marked as a duplicate of this bug. ***
Comment 34 Matthew Barnes 2012-08-24 18:40:07 UTC
*** Bug 682631 has been marked as a duplicate of this bug. ***
Comment 35 Matthew Barnes 2013-09-06 13:07:56 UTC
*** Bug 707624 has been marked as a duplicate of this bug. ***
Comment 36 web.cosas 2014-01-31 13:51:50 UTC
I know this is an old bug, but I'm seeing the same problem now in Evolution 3.10, running Fedora 20. Reading the thread I'm not sure if there's anything I can do directly to solve it, since (I guess) it was solved upstream some time ago.

BTW, the problem appears only with some gtk themes (for example Evolve), but not Adwaita.
Comment 37 Per 2014-04-26 05:39:13 UTC
I have also seen this bug resurface using the Evolve theme. Evolution 3.10.4 and gtk-3.10.8 (Ubuntu 14.04 LTS). Also happens in gedit. In Evolution black areas appear specifically around buttons and the headers in Evolution. Does not happen with the Adwaita theme.
Comment 38 Per 2014-04-28 19:32:21 UTC
After consulting with Milan on evolution-list I agree this is not an Evolution issue, but rather an issue with non-built-in themes that do not define the background-color property for all elements in their stylesheets. For the Evolve theme, I found this the following to fix the problem the issue with default back backgrounds in Evolution, gedit and Gnome Tweak.

Add:
* { background-color: @theme_bg_color; }

at the top of:
/usr/share/themes/Evolve/gtk-3.0/gtk-widgets.css:

This sets the background-color on all elements to the theme's default background color where none is explicitly defined.
Comment 39 Benjamin Otte (Company) 2014-04-28 20:01:07 UTC
(In reply to comment #38)
> * { background-color: @theme_bg_color; }
>
> at the top of:
> /usr/share/themes/Evolve/gtk-3.0/gtk-widgets.css:
> 
> This sets the background-color on all elements to the theme's default
> background color where none is explicitly defined.

That's a bad idea though because it draws a lot more stuff and because labels inside buttons suddenly draw backgrounds. So I would strongly advise against defining backgrounds this broadly in themes.

However, widgets that insist on having a background should add the BACKGROUND style class using gtk_style_context_add_class(). It's the class that GtkWindow uses to ensure it has a background.