Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 55456 - GTK: Toolbar setBackground is incorrect
Summary: GTK: Toolbar setBackground is incorrect
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-20 13:32 EST by Rutger Ovidius CLA
Modified: 2016-01-25 04:35 EST (History)
5 users (show)

See Also:


Attachments
Screenshot (1.85 KB, image/png)
2004-03-20 13:43 EST, Rutger Ovidius CLA
no flags Details
Screenshot depicting the problem in question. (1.18 KB, image/png)
2009-06-01 19:01 EDT, Remy Suen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rutger Ovidius CLA 2004-03-20 13:32:50 EST
public class Main {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setBackground(display.getSystemColor
(SWT.COLOR_INFO_BACKGROUND));
		ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.BORDER);
		toolBar
				.setBackground(display
						.getSystemColor
(SWT.COLOR_INFO_BACKGROUND));
		for (int i = 0; i < 12; i++) {
			ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN);
			item.setText("test");
		}
		toolBar.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}

Before flat toolbars, this worked. Afterwards, the background colour is 
incorrect.  I'll include a screenshot.
Comment 1 Rutger Ovidius CLA 2004-03-20 13:43:06 EST
Created attachment 8727 [details]
Screenshot

Screenshot. Industrial theme.
Comment 2 Billy Biggs CLA 2004-04-05 11:25:36 EDT
I ran the test app on I20040330 and the background was the same.  Is this
problem fixed?
Comment 3 Silenio Quarti CLA 2004-04-06 10:45:08 EDT
SWT has not changed anything that would fix this problem.
Comment 4 Rutger Ovidius CLA 2004-04-10 22:32:03 EDT
I am using I20040406 and still experience the problem.


Comment 5 Billy Biggs CLA 2005-05-08 17:02:06 EDT
I am sorry, but I've tried this with a lot of different themes using SWT from
3.0.1 and still cannot reproduce the problem.  Please re-open if you can
reproduce this with SWT from 3.0.1 or 3.1.
Comment 6 Remy Suen CLA 2009-06-01 19:01:31 EDT
Created attachment 137918 [details]
Screenshot depicting the problem in question.

I'm not sure if my problem is the same as the reporter's but it fits the summary wherein calling setBackground(Color) seems to do nothing. Instead of getting a green background, I get the standard background colour. What's odd is that for a split second before the items are drawn, you can actually see that that section of the window is green. I'm guessing this is fine on Windows because Kai's CSS demo seems to look fine on Vista. On GTK+ the bar doesn't change colours though. :(

-------------

Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(300, 200);
shell.setLayout(new GridLayout());
ToolBar toolBar = new ToolBar(shell, SWT.BORDER);
for (int i = 0; i < 3; i++) {
	ToolItem item = new ToolItem(toolBar, SWT.PUSH);
	item.setText("test"); //$NON-NLS-1$
}
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
toolBar.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
shell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
shell.open();
while (!shell.isDisposed()) {
	if (!display.readAndDispatch())
		display.sleep();
}
display.dispose();
Comment 7 Remy Suen CLA 2009-06-01 19:02:26 EDT
Reopening as it's a problem on I20090528-2000. I don't know if it was ever fixed (since it was closed as WORKSFORME).
Comment 8 Remy Suen CLA 2009-06-01 19:07:59 EDT
Back to inbox since Billy doesn't work on SWT anymore.
Comment 9 Remy Suen CLA 2009-06-02 09:06:09 EDT
(In reply to comment #6)
> Created an attachment (id=137918) [details]
> Screenshot depicting the problem in question.

This seems to be caused by my GTK+ theme. Is SWT supposed to override the theme's behaviour?
Comment 10 Steve Northover CLA 2009-06-02 10:19:08 EDT
Not for 3.5
Comment 11 Alexander Kurtakov CLA 2016-01-06 01:16:19 EST
I can't reproduce the bug on latest Neon builds. Resolving the bug please reopen if it still happens with recent Swt.
Comment 12 Sravan Kumar Lakkimsetti CLA 2016-01-25 03:54:54 EST
Verified in I20160124-0800 on linux ppc64.
Comment 13 Sravan Kumar Lakkimsetti CLA 2016-01-25 04:35:36 EST
Verified in I20160124-0800 on ubuntu 15.10 64bit