Bug 497331 - [GTK3] Platform.UI JFace, some tests fail on gtk3
Fixed all JFace errors encountered on my Fedora 24.
Previously Tree/Table was returning parent foreground color if
foreground == null. Overloaded getContextColor() so that foreground
color would be set to COLOR_LIST_FOREGROUND instead of
COLOR_WIDGET_FOREGROUND when foreground == null.
Change-Id: I0807a80a475ed942c3d72712a72e37d56724a45d
Signed-off-by: Ian Pun <ipun@redhat.com>
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 e1f84ec..9215ed2 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
@@ -80,7 +80,7 @@
boolean firstCustomDraw;
int drawState, drawFlags;
GdkColor drawForeground;
- GdkRGBA background;
+ GdkRGBA background, foreground;
boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
int maxWidth = 0;
@@ -1363,6 +1363,19 @@
}
}
+@Override
+GdkColor getContextColor () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (foreground != null) {
+ return display.toGdkColor (foreground);
+ } else {
+ return display.COLOR_LIST_FOREGROUND;
+ }
+ } else {
+ return super.getContextColor ();
+ }
+}
+
TableItem getFocusItem () {
long /*int*/ [] path = new long /*int*/ [1];
OS.gtk_tree_view_get_cursor (handle, path, null);
@@ -3276,6 +3289,7 @@
if (color != null) {
rgba = display.toGdkRGBA (color);
}
+ foreground = rgba;
setForegroundColor (handle, rgba);
} else {
setForegroundColor (handle, color, false);
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 c8d6c23..0fcb8ef 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
@@ -89,7 +89,7 @@
boolean expandAll;
int drawState, drawFlags;
GdkColor drawForeground;
- GdkRGBA background;
+ GdkRGBA background, foreground;
boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet;
int pixbufHeight, pixbufWidth;
@@ -1355,6 +1355,19 @@
}
@Override
+GdkColor getContextColor () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
+ if (foreground != null) {
+ return display.toGdkColor (foreground);
+ } else {
+ return display.COLOR_LIST_FOREGROUND;
+ }
+ } else {
+ return super.getContextColor ();
+ }
+}
+
+@Override
GdkColor getContextBackground () {
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
if (background != null) {
@@ -3267,6 +3280,7 @@
if (color != null) {
rgba = display.toGdkRGBA (color);
}
+ foreground = rgba;
setForegroundColor (handle, rgba);
} else {
setForegroundColor (handle, color, false);