Bug 393723 - [GTK3] wrong foreground in Eclipse editor area unselected tabs
Summary: [GTK3] wrong foreground in Eclipse editor area unselected tabs
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M4   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-11-06 17:29 EST by Silenio Quarti CLA
Modified: 2012-11-16 10:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Silenio Quarti CLA 2012-11-06 17:29:06 EST
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).
Comment 1 Silenio Quarti CLA 2012-11-14 16:00:16 EST
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();
}

}
Comment 2 Silenio Quarti CLA 2012-11-14 16:49:38 EST
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();
}
Comment 3 Silenio Quarti CLA 2012-11-15 15:14:05 EST
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