Community
Participate
Working Groups
1) Run eclipse on GTK3 (export org.eclipse.swt.gtk3=1) 2) Open a couple of editors Note that the foreground color of the unselected editor tab does match the GTK2 port and it is hard to read (white on almost white).
I am not sure what is the problem yet, but this snippet reproduces it. Somehow the composite foreground is inherited from the shell after the shell foreground is changed and its own background is changed. import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class Snippet153 { public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10, 10, 200, 200); Composite comp = new Composite(shell, SWT.NONE); System.out.println("shell back=" + shell.getBackground()); System.out.println("shell fore=" + shell.getForeground()); System.out.println("back=" + comp.getBackground()); System.out.println("fore=" + comp.getForeground()); shell.setForeground(new Color(display, 240, 240, 240)); comp.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); System.out.println("after"); System.out.println("shell back=" + shell.getBackground()); System.out.println("shell fore=" + shell.getForeground()); System.out.println("back=" + comp.getBackground()); System.out.println("fore=" + comp.getForeground()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Simple PI code that reproduces the problem: public static void main(String[] args) { OS.gtk_init_check(new long[]{0}, null); long window = OS.gtk_window_new(OS.GTK_WINDOW_TOPLEVEL); long fixed = OS.gtk_fixed_new(); OS.gtk_container_add(window, fixed); OS.gtk_widget_show(window); GdkRGBA color; long context = OS.gtk_widget_get_style_context(fixed); color = new GdkRGBA(); OS.gtk_style_context_get_color(context, 0, color); System.out.println("before=" + color.red + " " + color.green + " " + color.blue); color = new GdkRGBA(); color.red = 1; OS.gtk_widget_override_color(window, 0, color);// commenting this line does not fail color = new GdkRGBA(); color.green = 1; OS.gtk_widget_override_background_color(fixed, 0, color);// commenting this line does not fail context = OS.gtk_widget_get_style_context(fixed); color = new GdkRGBA(); OS.gtk_style_context_get_color(context, 0, color); System.out.println("after=" + color.red + " " + color.green + " " + color.blue); OS.gtk_main(); }
In GTK 3, the foreground is inherited from the immediate parent. Fixed: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=592d29b2d91e140852d4120c2dafd39589e57883