Community
Participate
Working Groups
Created attachment 282950 [details] Example showing the bug for Tree Expected behaviour: - Foreground colors for each row (or cell) can be set when creating the Tree/TableItem instances ("static"). - Furthermore, the colors can also be set as late as inside the handler for the EraseItem event ("dynamic"). Actual behaviour: - In SWT 4.11: works in Windows and x86-64 Linux - In SWT 4.12 and above: Works in Windows but fails in x86-64 Linux. * Custom background colors (both statically and dynamically set) still work * Custom foreground colors are lost entirely, even if the event handler does not actually do anything. As soon as a listener for any of MeasureItem, EraseItem or PaintItem is registered, the custom foreground is ignored and the text is black. The attached example shows the problem with the Tree widget, but the exact same occurs with Table - I can attach its own example if needed. If the listener is not added to the widget, colors that are set "statically" work in all cases. If it is added, everything works on SWT 4.11 (or later versions in Windows), but in Linux with SWT>=4.12 only the background is customized. Environment info: Ubuntu 18.04 org.eclipse.swt.internal.deviceZoom=100 org.eclipse.swt.internal.gdk.backend=x11 org.eclipse.swt.internal.gtk.theme=Ambiance org.eclipse.swt.internal.gtk.version=3.22.30
Created attachment 282953 [details] The result in SWT 4.11, looking as expected
Created attachment 282954 [details] Result in SWT 4.12 when the bug is triggered (no foreground colors at all)
Created attachment 282955 [details] Result in both versions when the Tree does not have an EraseItem listener In this case, the foreground colors set "statically" (outside the listener) render correctly in the newer versions too.
Bug is still present in SWT 4.20 on Gtk, reproducible with the same originally-attached example code. Background colours work, but the moment the listener is attached, all foreground colours stop working, no matter if they were set before the listener or inside it. Environment info: Debian 10, using the Eclipse 2021-06-bundled JustJ JRE16. org.eclipse.swt.internal.deviceZoom=100 org.eclipse.swt.internal.gdk.backend=x11 org.eclipse.swt.internal.gtk.theme=Adwaita org.eclipse.swt.internal.gtk.version=3.24.5 org.eclipse.swt.internal.webkitgtk.version=2.32.1