diff options
author | Eric Williams | 2019-02-19 20:02:29 +0000 |
---|---|---|
committer | Eric Williams | 2019-03-11 18:45:45 +0000 |
commit | eef687cb0ba0e614571caf5af7dc4ad829aeed1b (patch) | |
tree | 889a6175f94a54943a1c822550b695177261df0b | |
parent | 092d68d1c71497fe32622e65742008ee50a1bac2 (diff) | |
download | eclipse.platform.swt-eef687cb0ba0e614571caf5af7dc4ad829aeed1b.tar.gz eclipse.platform.swt-eef687cb0ba0e614571caf5af7dc4ad829aeed1b.tar.xz eclipse.platform.swt-eef687cb0ba0e614571caf5af7dc4ad829aeed1b.zip |
Bug 294300: [GTK] Incorrect behaviour of tree rendering on GTK after
removing paint listener
When SWT.FOREGROUND is set, it means the Tree/Table is reponsible for
drawing its own foreground according to default parameters. This means
using the foreground set by setForeground(), or the default system
foreground (COLOR_LIST_FOREGROUND in this case).
Change-Id: I513fab6bd33aa97d2b43bb5681ac44581892c5f8
Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | 10 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 59f5b83eec..2c54a38c01 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -3079,8 +3079,14 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ snapshot, long /*int*/ g_class = OS.g_type_class_peek_parent (OS.G_OBJECT_GET_CLASS (cell)); GtkCellRendererClass klass = new GtkCellRendererClass (); OS.memmove (klass, g_class); - if (drawForegroundRGBA != null && GTK.GTK_IS_CELL_RENDERER_TEXT (cell)) { - OS.g_object_set (cell, OS.foreground_rgba, drawForegroundRGBA, 0); + if (GTK.GTK_IS_CELL_RENDERER_TEXT (cell)) { + /* + * SWT.FOREGROUND means the Table is responsible for painting the default foreground + * color. This can be either the system default (COLOR_LIST_FOREGROUND), or the + * color set by setForeground(). See bug 294300. + */ + GdkRGBA rgba = foreground != null ? foreground : display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).handle; + OS.g_object_set (cell, OS.foreground_rgba, rgba, 0); } if (GTK.GTK4) { OS.call (klass.snapshot, cell, snapshot, widget, background_area, cell_area, drawFlags); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index f7e2dfbe34..8d2806b1b3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -3146,8 +3146,14 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ snapshot, long /*int*/ g_class = OS.g_type_class_peek_parent (OS.G_OBJECT_GET_CLASS (cell)); GtkCellRendererClass klass = new GtkCellRendererClass (); OS.memmove (klass, g_class); - if (drawForegroundRGBA != null && GTK.GTK_IS_CELL_RENDERER_TEXT (cell)) { - OS.g_object_set (cell, OS.foreground_rgba, drawForegroundRGBA, 0); + if (GTK.GTK_IS_CELL_RENDERER_TEXT (cell)) { + /* + * SWT.FOREGROUND means the Tree is responsible for painting the default foreground + * color. This can be either the system default (COLOR_LIST_FOREGROUND), or the + * color set by setForeground(). See bug 294300. + */ + GdkRGBA rgba = foreground != null ? foreground : display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).handle; + OS.g_object_set (cell, OS.foreground_rgba, rgba, 0); } if (GTK.GTK4) { OS.call (klass.snapshot, cell, snapshot, widget, background_area, cell_area, drawFlags); |