Community
Participate
Working Groups
This snippet fails on GTK3 when running on Fedora 18. import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class Test { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBackgroundImage(display.getSystemImage(SWT.ICON_ERROR)); Composite composite = new Composite(shell, SWT.BORDER); composite.setBounds(30, 20, 200, 200); composite.setBackgroundImage(display.getSystemImage(SWT.ICON_WARNING)); shell.setSize(300, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
This also fails on Ubuntu 12.10. I have investigated whether we could have our own implementation of GtkStyleProvider and use it instead of the gtk_widget_override_XXX in order to set color/background-color/font and background-image. There is no API to override the background-image in the GtkModifierStyle and using the GtkCssProvider is problematic because we would have to serialize fonts in CSS strings and in-memory images would have to be saved to disk to let the theming engine load it. It turns out that implementing our own GtkStyleProvider (so that you could override background-image as well) is impossible using only public API. In order to proper implement a GtkStyleProvider, we would need to add the GtkStyleProviderPrivate interface which is not available. This patch fixes the problem by drawing the background image ourselves. Note that it also draws the background color of canvas when it is transparent. This is done to solve the fact that the preferences window is white instead of grey. Fixed http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=fb6bc4c89147f7b506bef4e864f80773bf8c749f