Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320145

Summary: GTK Combo with a black foreground always uses a white foreground on the hovered list item
Product: [Eclipse Project] Platform Reporter: Heath Borders <heath.borders>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Heath Borders CLA 2010-07-16 17:23:58 EDT
Build Identifier: 

On GTK, when a Combo has a black foreground (either by explicitly setting the foreground to black, or by using the system default and setting the foreground to null)  and a non-white background and the Combo's list is visibile, the list item over which the user is hovering has its foreground set to white.

This is not consistent with the behavior of windows.

Reproducible: Always

Steps to Reproduce:
public class GtkComboHoverBackgroundBug {
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell();
		shell.setLayout(new GridLayout());

		final Combo combo = new Combo(shell, SWT.READ_ONLY);
		combo.setBackground(new Color(display, new RGB(255, 255, 254)));
		combo.setForeground(new Color(display, new RGB(0, 0, 0)));
		combo.setItems(new String[] { "0", "1", "2", });
		combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

		final Button button = new Button(shell, SWT.TOGGLE);
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if (button.getSelection()) {
					combo.setForeground(new Color(display, new RGB(0, 0, 1)));
					button.setText("Switch to black");
				} else {
					combo.setForeground(null);
					button.setText("Switch to non-black");
				}
				shell.layout(true, true);
			}
		});
		button.setText("Switch to non-black");
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}
}
Comment 1 Alexander Kurtakov CLA 2013-12-20 05:20:20 EST
Can you attach a screenshot of the windows behaviour ? What do you think is the correct behavior?
Comment 2 Alexander Kurtakov CLA 2014-02-13 09:02:30 EST
More than a month without reply and it is unclear to me what is considered to be the right behaviour in this case. Closing.
Please reopen when you have time to help us improve.