Bug 563391 - [GTK] Tree and Table items lose custom foreground colors when any of MeasureItem, EraseItem or PaintItem are registered
Summary: [GTK] Tree and Table items lose custom foreground colors when any of MeasureI...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.12   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-05-20 05:47 EDT by Javier Martin CLA
Modified: 2021-07-28 05:23 EDT (History)
1 user (show)

See Also:


Attachments
Example showing the bug for Tree (2.21 KB, application/octet-stream)
2020-05-20 05:47 EDT, Javier Martin CLA
no flags Details
The result in SWT 4.11, looking as expected (10.60 KB, image/png)
2020-05-20 07:55 EDT, Javier Martin CLA
no flags Details
Result in SWT 4.12 when the bug is triggered (no foreground colors at all) (7.53 KB, image/png)
2020-05-20 07:55 EDT, Javier Martin CLA
no flags Details
Result in both versions when the Tree does not have an EraseItem listener (6.67 KB, image/png)
2020-05-20 07:57 EDT, Javier Martin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Martin CLA 2020-05-20 05:47:38 EDT
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
Comment 1 Javier Martin CLA 2020-05-20 07:55:03 EDT
Created attachment 282953 [details]
The result in SWT 4.11, looking as expected
Comment 2 Javier Martin CLA 2020-05-20 07:55:40 EDT
Created attachment 282954 [details]
Result in SWT 4.12 when the bug is triggered (no foreground colors at all)
Comment 3 Javier Martin CLA 2020-05-20 07:57:05 EDT
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.
Comment 4 Javier Martin CLA 2021-07-28 05:23:20 EDT
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