diff --git a/.gitignore b/.gitignore index 687859ea784..dbddb3c2bb6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ pom.tycho /binaries/org.eclipse.swt.*/src/ tmpdir/ ‎build_gtk.sh +build_gtk.sh 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 3b2b5523d33..dbbb13ac8a1 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 @@ -1557,13 +1557,15 @@ public int getColumnCount () { @Override GdkRGBA getContextBackgroundGdkRGBA () { - if (background != null) { - return background; - } else { - // For Tables and Trees, the default background is - // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND. - return defaultBackground(); - } + // Bug 2702: When a custom background is set, delegate to Control's implementation + // which parses from the CSS provider. This prevents focus issues that occur when + // returning the stored background field value directly. + if (background != null && background != defaultBackground()) { + return super.getContextBackgroundGdkRGBA(); + } + // For Tables and Trees, the default background is + // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND. + return defaultBackground(); } @Override